I upgrade my Flutter version from v2.10.4 to v3.3.10 , amount of errors occure like this:
# main(2)
_CastError
Null check operator used on a null value
#0 RenderBox.size (package:flutter/src/rendering/box.dart:2023)
#1 RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:253)
#2 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#3 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#4 ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:56)
#5 RenderFlex._computeSizes (package:flutter/src/rendering/flex.dart:836)
#6 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:938)
#7 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#8 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#9 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120)
#10 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#11 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#12 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120)
#13 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1462)
#14 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#15 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#16 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120)
#17 _RenderCustomClip.performLayout (package:flutter/src/rendering/proxy_box.dart:1462)
#18 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#19 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#20 RenderConstrainedBox.performLayout (package:flutter/src/rendering/proxy_box.dart:292)
#21 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#22 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#23 RenderPositionedBox.performLayout (package:flutter/src/rendering/shifted_box.dart:451)
#24 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#25 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#26 RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:249)
#27 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#28 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#29 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120)
#30 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#31 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#32 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120)
#33 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#34 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#35 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120)
#36 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#37 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#38 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120)
#39 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#40 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#41 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120)
#42 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#43 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#44 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120)
#45 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#46 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#47 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120)
#48 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#49 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#50 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120)
#51 RenderOffstage.performLayout (package:flutter/src/rendering/proxy_box.dart:3737)
#52 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#53 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#54 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:120)
#55 RenderObject.layout (package:flutter/src/rendering/object.dart:2135)
#56 RenderBox.layout (package:flutter/src/rendering/box.dart:2418)
#57 _RenderTheatre.performLayout (package:flutter/src/widgets/overlay.dart:804)
#58 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1973)
#59 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:999)
#60 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:513)
#61 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:884)
#62 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:378)
#63 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1175)
#64 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1104)
#65 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1015)
#66 _rootRun (dart:async/zone.dart:1391)
#67 _CustomZone.run (dart:async/zone.dart:1293)
#68 _CustomZone.runGuarded (dart:async/zone.dart:1201)
#69 _invoke (dart:ui/hooks.dart:150)
#70 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:318)
#71 _drawFrame (dart:ui/hooks.dart:115)
According to the stack, all of them from the flutter framework. I have no idea to find out where causes this error in my code.
I guess it must a wrong stage during widget rendering.
Can you give me some idea?
My pubspec.yaml like this:
environment:
sdk: ">=2.10.0 <3.0.0"
flutter: ^3.3.10
According to the page tracking info, I finally find out this issue:
I use routes#showGeneralDialog to display a widget with wrong width.
Related
I am writing a program with a simple page scroller that changes pages when scrolled. I want to have these pages changed this way such that I can be able to change them with another widget that will be inserted into the stack. Currently, I am not fully understanding the error and would like to know why the error is thrown. The error is shown below. Each screen page item has only a Scaffold with text inside body.
import 'package:flutter/material.dart';
import 'package:provider/provider.dart';
import '../screens/account.dart';
import '../screens/home.dart';
import '../screens/post.dart';
import '../screens/saved.dart';
class ScreenChanger extends StatefulWidget {
const ScreenChanger({Key? key}) : super(key: key);
#override
State<ScreenChanger> createState() => _ScreenChangerState();
}
class _ScreenChangerState extends State<ScreenChanger> {
late HomeScreen homeScreen;
late SavedScreen savedScreen;
late PostScreen postScreen;
late AccountScreen accountScreen;
#override
void initState() {
homeScreen=HomeScreen();
savedScreen=SavedScreen();
postScreen=PostScreen();
accountScreen=AccountScreen();
super.initState();
}
#override
Widget build(BuildContext context) {
return Scaffold(
body: ChangeNotifierProvider(
create: (_) { return ScreenController(); },
builder: (context, child) {
return Stack(
children: [
PageView.builder(
itemCount: 4,
itemBuilder: (context, index) {
setState(() {
Provider.of<ScreenController>(context, listen: false).currentPage=index;
});
return [
homeScreen,
savedScreen,
postScreen,
accountScreen,
][Provider.of<ScreenController>(context).currentPage];
},
),
],
);
},
),
);
}
}
class ScreenController extends ChangeNotifier{
late int _currentPage;
int get currentPage => _currentPage;
set currentPage(int value) {
_currentPage = value;
notifyListeners();
}
ScreenController({
int currentPage = 0
}){
this.currentPage=currentPage;
}
}
Error
======== Exception caught by foundation library ====================================================
The following assertion was thrown while dispatching notifications for ScreenController:
setState() or markNeedsBuild() called during build.
This _InheritedProviderScope<ScreenController?> widget cannot be marked as needing to build because the framework is already in the process of building widgets. A widget can be marked as needing to be built during the build phase only if one of its ancestors is currently building. This exception is allowed because the framework builds parent widgets before children, which means a dirty descendant will always be built. Otherwise, the framework might not visit this widget during this build phase.
The widget on which setState() or markNeedsBuild() was called was: _InheritedProviderScope<ScreenController?>
value: Instance of 'ScreenController'
listening to value
The widget which was currently being built when the offending call was made was: SliverFillViewport
When the exception was thrown, this was the stack:
#0 Element.markNeedsBuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:4549:11)
#1 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:4564:6)
#2 _InheritedProviderScopeElement.markNeedsNotifyDependents (package:provider/src/inherited_provider.dart:577:5)
#3 ChangeNotifier.notifyListeners (package:flutter/src/foundation/change_notifier.dart:351:24)
#4 ScreenController.currentPage= (package:real_estate_v02/widgets/screen_changer.dart:69:5)
#5 _ScreenChangerState.build.<anonymous closure>.<anonymous closure>.<anonymous closure> (package:real_estate_v02/widgets/screen_changer.dart:45:75)
#6 State.setState (package:flutter/src/widgets/framework.dart:1114:30)
#7 _ScreenChangerState.build.<anonymous closure>.<anonymous closure> (package:real_estate_v02/widgets/screen_changer.dart:44:19)
#8 SliverChildBuilderDelegate.build (package:flutter/src/widgets/sliver.dart:485:22)
#9 SliverMultiBoxAdaptorElement._build (package:flutter/src/widgets/sliver.dart:1376:28)
#10 SliverMultiBoxAdaptorElement.performRebuild.processElement (package:flutter/src/widgets/sliver.dart:1306:67)
#11 Iterable.forEach (dart:core/iterable.dart:325:35)
#12 SliverMultiBoxAdaptorElement.performRebuild (package:flutter/src/widgets/sliver.dart:1353:24)
#13 SliverMultiBoxAdaptorElement.update (package:flutter/src/widgets/sliver.dart:1282:7)
#14 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#15 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#16 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#17 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#18 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#19 StatelessElement.update (package:flutter/src/widgets/framework.dart:4956:5)
#20 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#21 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5904:32)
#22 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6460:17)
#23 _ViewportElement.update (package:flutter/src/widgets/viewport.dart:237:11)
#24 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#25 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#26 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#27 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#28 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#29 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#30 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#31 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#32 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#33 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#34 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5050:11)
#35 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#36 StatefulElement.update (package:flutter/src/widgets/framework.dart:5082:5)
#37 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#38 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#39 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#40 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#41 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#42 ProxyElement.update (package:flutter/src/widgets/framework.dart:5228:5)
#43 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#44 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#45 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#46 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#47 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#48 ProxyElement.update (package:flutter/src/widgets/framework.dart:5228:5)
#49 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#50 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#51 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#52 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#53 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#54 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#55 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#56 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#57 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#58 ProxyElement.update (package:flutter/src/widgets/framework.dart:5228:5)
#59 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#60 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#61 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5050:11)
#62 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#63 StatefulElement.update (package:flutter/src/widgets/framework.dart:5082:5)
#64 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#65 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#66 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5050:11)
#67 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#68 StatefulElement.update (package:flutter/src/widgets/framework.dart:5082:5)
#69 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#70 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#71 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#72 ProxyElement.update (package:flutter/src/widgets/framework.dart:5228:5)
#73 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#74 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#75 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5050:11)
#76 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#77 StatefulElement.update (package:flutter/src/widgets/framework.dart:5082:5)
#78 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#79 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5904:32)
#80 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6460:17)
#81 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#82 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#83 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#84 StatelessElement.update (package:flutter/src/widgets/framework.dart:4956:5)
#85 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#86 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#87 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#88 ProxyElement.update (package:flutter/src/widgets/framework.dart:5228:5)
#89 _InheritedProviderScopeElement.update (package:provider/src/inherited_provider.dart:523:11)
#90 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#91 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#92 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#93 StatelessElement.update (package:flutter/src/widgets/framework.dart:4956:5)
#94 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#95 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#96 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#97 StatelessElement.update (package:flutter/src/widgets/framework.dart:4956:5)
#98 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#99 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#100 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
.......
#350 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1104:9)
#351 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:881:7)
(elided 4 frames from class _RawReceivePortImpl, class _Timer, and dart:async-patch)
The ScreenController sending notification was: Instance of 'ScreenController'
====================================================================================================
======== Exception caught by widgets library =======================================================
The following assertion was thrown building:
setState() or markNeedsBuild() called during build.
This ScreenChanger widget cannot be marked as needing to build because the framework is already in the process of building widgets. A widget can be marked as needing to be built during the build phase only if one of its ancestors is currently building. This exception is allowed because the framework builds parent widgets before children, which means a dirty descendant will always be built. Otherwise, the framework might not visit this widget during this build phase.
The widget on which setState() or markNeedsBuild() was called was: ScreenChanger
state: _ScreenChangerState#ffffa
The widget which was currently being built when the offending call was made was: SliverFillViewport
When the exception was thrown, this was the stack:
#0 Element.markNeedsBuild.<anonymous closure> (package:flutter/src/widgets/framework.dart:4549:11)
#1 Element.markNeedsBuild (package:flutter/src/widgets/framework.dart:4564:6)
#2 State.setState (package:flutter/src/widgets/framework.dart:1134:15)
#3 _ScreenChangerState.build.<anonymous closure>.<anonymous closure> (package:real_estate_v02/widgets/screen_changer.dart:44:19)
#4 SliverChildBuilderDelegate.build (package:flutter/src/widgets/sliver.dart:485:22)
#5 SliverMultiBoxAdaptorElement._build (package:flutter/src/widgets/sliver.dart:1376:28)
#6 SliverMultiBoxAdaptorElement.performRebuild.processElement (package:flutter/src/widgets/sliver.dart:1306:67)
#7 Iterable.forEach (dart:core/iterable.dart:325:35)
#8 SliverMultiBoxAdaptorElement.performRebuild (package:flutter/src/widgets/sliver.dart:1353:24)
#9 SliverMultiBoxAdaptorElement.update (package:flutter/src/widgets/sliver.dart:1282:7)
#10 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#11 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#12 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#13 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#14 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#15 StatelessElement.update (package:flutter/src/widgets/framework.dart:4956:5)
#16 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#17 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5904:32)
#18 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6460:17)
#19 _ViewportElement.update (package:flutter/src/widgets/viewport.dart:237:11)
#20 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#21 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#22 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#23 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#24 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#25 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#26 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#27 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#28 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#29 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#30 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5050:11)
#31 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#32 StatefulElement.update (package:flutter/src/widgets/framework.dart:5082:5)
#33 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#34 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#35 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#36 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#37 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#38 ProxyElement.update (package:flutter/src/widgets/framework.dart:5228:5)
#39 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#40 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#41 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#42 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#43 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#44 ProxyElement.update (package:flutter/src/widgets/framework.dart:5228:5)
#45 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#46 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#47 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#48 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#49 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#50 SingleChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6307:14)
#51 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#52 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#53 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#54 ProxyElement.update (package:flutter/src/widgets/framework.dart:5228:5)
#55 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#56 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#57 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5050:11)
#58 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#59 StatefulElement.update (package:flutter/src/widgets/framework.dart:5082:5)
#60 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#61 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#62 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5050:11)
#63 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#64 StatefulElement.update (package:flutter/src/widgets/framework.dart:5082:5)
#65 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#66 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#67 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#68 ProxyElement.update (package:flutter/src/widgets/framework.dart:5228:5)
#69 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#70 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#71 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5050:11)
#72 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#73 StatefulElement.update (package:flutter/src/widgets/framework.dart:5082:5)
#74 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#75 RenderObjectElement.updateChildren (package:flutter/src/widgets/framework.dart:5904:32)
#76 MultiChildRenderObjectElement.update (package:flutter/src/widgets/framework.dart:6460:17)
#77 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#78 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#79 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#80 StatelessElement.update (package:flutter/src/widgets/framework.dart:4956:5)
#81 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#82 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#83 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#84 ProxyElement.update (package:flutter/src/widgets/framework.dart:5228:5)
#85 _InheritedProviderScopeElement.update (package:provider/src/inherited_provider.dart:523:11)
#86 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#87 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#88 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#89 StatelessElement.update (package:flutter/src/widgets/framework.dart:4956:5)
#90 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#91 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#92 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#93 StatelessElement.update (package:flutter/src/widgets/framework.dart:4956:5)
#94 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#95 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#96 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
#97 StatelessElement.update (package:flutter/src/widgets/framework.dart:4956:5)
#98 Element.updateChild (package:flutter/src/widgets/framework.dart:3570:15)
#99 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16)
#100 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5)
.....
#345 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1175:15)
#346 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1104:9)
#347 SchedulerBinding.scheduleWarmUpFrame.<anonymous closure> (package:flutter/src/scheduler/binding.dart:881:7)
(elided 4 frames from class _RawReceivePortImpl, class _Timer, and dart:async-patch)
====================================================================================================
Found another solution:
Widget build(BuildContext context) {
return Scaffold(
body: ChangeNotifierProvider(
create: (_) { return ScreenController(); },
builder: (context, child) {
final screenController = Provider.of<ScreenController>(context);
return Stack(
children: [
PageView.builder(
itemCount: 4,
itemBuilder: (context, index) {
setState(() {
screenController.currentPage=index;
});
return [
homeScreen,
savedScreen,
postScreen,
accountScreen,
][screenController.currentPage];
},
),
],
);
},
),
);
}
You are calling setState middle of widget build. You can wait to finish the frame and then call setState.
WidgetsBinding.instance.addPostFrameCallback((timeStamp) {
Provider.of<ScreenController>(context, listen: false).currentPage = index;
}); // you may not needed using setState because there is not state variable needed to be updated
I am building a Flutter application -using Navigator 2.0 with go_router- with nested navigation on the bottom navigation bar, and 3 sub-route on the Home route: Single Post, Single Category, and Single Tag.
When I tried to open a single post URL on the browser, the deep link worked, and it opened the Single Post page on the app. But then, when I clicked the page's back button or the android back-gesture, it has thrown a _CastError: Null check operator used on a null value, and the Home page is not displayed.
What's wrong here, and how can I solve this?
Here is the source code: https://github.com/KweeksNews/kweeksnews_app/tree/develop (branch develop)
Error is thrown on this line: https://github.com/KweeksNews/kweeksnews_app/blob/11747545ab09dfc829ce02094ad16f9735cc39be/lib/core/widgets/navbar.dart#L68
Here is the debug log:
════════ Exception caught by widgets library ═══════════════════════════════════
The following _CastError was thrown, building Builder:
Null check operator used on a null value
The relevant error-causing widget was
MaterialApp
When the exception was thrown, this was the stack
#0 ScrollPosition.viewportDimension
#1 _PagePosition.getPixelsFromPage
#2 PageController.jumpToPage
#3 _NavBarState.didUpdateWidget
#4 StatefulElement.update
#5 Element.updateChild
#6 SingleChildRenderObjectElement.update
#7 Element.updateChild
#8 ComponentElement.performRebuild
#9 Element.rebuild
#10 StatelessElement.update
#11 Element.updateChild
#12 SingleChildRenderObjectElement.update
#13 Element.updateChild
#14 SingleChildRenderObjectElement.update
#15 Element.updateChild
#16 ComponentElement.performRebuild
#17 StatefulElement.performRebuild
#18 Element.rebuild
#19 StatefulElement.update
#20 Element.updateChild
#21 SingleChildRenderObjectElement.update
#22 Element.updateChild
#23 SingleChildRenderObjectElement.update
#24 Element.updateChild
#25 ComponentElement.performRebuild
#26 StatefulElement.performRebuild
#27 Element.rebuild
#28 StatefulElement.update
#29 Element.updateChild
#30 ComponentElement.performRebuild
#31 Element.rebuild
#32 StatelessElement.update
#33 Element.updateChild
#34 ComponentElement.performRebuild
#35 StatefulElement.performRebuild
#36 Element.rebuild
#37 StatefulElement.update
#38 Element.updateChild
#39 SingleChildRenderObjectElement.update
#40 Element.updateChild
#41 SingleChildRenderObjectElement.update
#42 Element.updateChild
#43 ComponentElement.performRebuild
#44 Element.rebuild
#45 ProxyElement.update
#46 _InheritedNotifierElement.update
#47 Element.updateChild
#48 SingleChildRenderObjectElement.update
#49 Element.updateChild
#50 ComponentElement.performRebuild
#51 StatefulElement.performRebuild
#52 Element.rebuild
#53 StatefulElement.update
#54 Element.updateChild
#55 ComponentElement.performRebuild
#56 Element.rebuild
#57 ProxyElement.update
#58 Element.updateChild
#59 ComponentElement.performRebuild
#60 Element.rebuild
#61 ProxyElement.update
#62 Element.updateChild
#63 ComponentElement.performRebuild
#64 StatefulElement.performRebuild
#65 Element.rebuild
#66 StatefulElement.update
#67 Element.updateChild
#68 ComponentElement.performRebuild
#69 Element.rebuild
#70 StatelessElement.update
#71 Element.updateChild
#72 ComponentElement.performRebuild
#73 Element.rebuild
#74 StatelessElement.update
#75 Element.updateChild
#76 SingleChildRenderObjectElement.update
#77 Element.updateChild
#78 ComponentElement.performRebuild
#79 Element.rebuild
#80 ProxyElement.update
#81 Element.updateChild
#82 ComponentElement.performRebuild
#83 Element.rebuild
#84 ProxyElement.update
#85 Element.updateChild
#86 ComponentElement.performRebuild
#87 StatefulElement.performRebuild
#88 Element.rebuild
#89 StatefulElement.update
#90 Element.updateChild
#91 ComponentElement.performRebuild
#92 StatefulElement.performRebuild
#93 Element.rebuild
#94 StatefulElement.update
#95 Element.updateChild
#96 ComponentElement.performRebuild
#97 StatefulElement.performRebuild
#98 Element.rebuild
#99 BuildOwner.buildScope
#100 WidgetsBinding.drawFrame
#101 RendererBinding._handlePersistentFrameCallback
#102 SchedulerBinding._invokeFrameCallback
#103 SchedulerBinding.handleDrawFrame
#104 SchedulerBinding._handleDrawFrame
#108 _invoke (dart:ui/hooks.dart:151:10)
#109 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:308:5)
#110 _drawFrame (dart:ui/hooks.dart:115:31)
I'm not pretty sure about the real cause, but this is what I think happened.
So when the app opened using deep link into SingePost page, the app puts a page containing Navbar widget first into the page stack, and then puts the SinglePost page on top of it. Here it should be noted that the Navbar is not yet rendered by the app.
The Navbar widget's body is a PageView containing 4 page: Home, Search, SavedPosts, and Settings. All four pages are implementing AutomaticKeepAliveClientMixin to save and keep the scroll position, so that when user is navigating to the other pages and return, the scroll position is persist.
When user is popping out from the SinglePost page, the app then will render the Navbar with Home as the PageView's selected child (because the Navbar is given with index parameter of 0). Now the interesting and confusing part is, the didUpdateWidget is also called when the Navbar is being rendered by the app after user popping out from SinglePost page, even no parameter is changed (the index still 0). This will trigger a _pageController.jumpToPage() function, which, I think, in turn will try to render the requested page with the last saved scroll position. But because the page has never been rendered before, the scroll position is Null.
To fix this, now I put a check to make sure the new index is different with the current index before calling the _pageController.jumpToPage() function, and it worked.
So I get the following error whenever I sign in through Google, but I only get it on my first login. If I log out and log back in, it never appears and the app works fine.
======== Exception caught by widgets library =======================================================
The following StateError was thrown building:
Bad state: field does not exist within the DocumentSnapshotPlatform
When the exception was thrown, this was the stack:
#0 DocumentSnapshotPlatform.get._findKeyValueInMap (package:cloud_firestore_platform_interface/src/platform_interface/platform_interface_document_snapshot.dart:87:7)
#1 DocumentSnapshotPlatform.get._findComponent (package:cloud_firestore_platform_interface/src/platform_interface/platform_interface_document_snapshot.dart:105:23)
#2 DocumentSnapshotPlatform.get (package:cloud_firestore_platform_interface/src/platform_interface/platform_interface_document_snapshot.dart:121:12)
#3 _JsonDocumentSnapshot.get (package:cloud_firestore/src/document_snapshot.dart:92:48)
#4 _JsonDocumentSnapshot.[] (package:cloud_firestore/src/document_snapshot.dart:96:40)
#5 _HomeState.chatRoomsList.<anonymous closure>.<anonymous closure> (package:connectlyapp/views/home.dart:58:45)
#6 SliverChildBuilderDelegate.build (package:flutter/src/widgets/sliver.dart:456:22)
#7 SliverMultiBoxAdaptorElement._build (package:flutter/src/widgets/sliver.dart:1214:28)
#8 SliverMultiBoxAdaptorElement.createChild.<anonymous closure> (package:flutter/src/widgets/sliver.dart:1227:55)
#9 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2573:19)
#10 SliverMultiBoxAdaptorElement.createChild (package:flutter/src/widgets/sliver.dart:1220:12)
#11 RenderSliverMultiBoxAdaptor._createOrObtainChild.<anonymous closure> (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:349:23)
#12 RenderObject.invokeLayoutCallback.<anonymous closure> (package:flutter/src/rendering/object.dart:1968:59)
#13 PipelineOwner._enableMutationsToDirtySubtrees (package:flutter/src/rendering/object.dart:916:15)
#14 RenderObject.invokeLayoutCallback (package:flutter/src/rendering/object.dart:1968:14)
#15 RenderSliverMultiBoxAdaptor._createOrObtainChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:338:5)
#16 RenderSliverMultiBoxAdaptor.addInitialChild (package:flutter/src/rendering/sliver_multi_box_adaptor.dart:422:5)
#17 RenderSliverList.performLayout (package:flutter/src/rendering/sliver_list.dart:79:12)
#18 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#19 RenderSliverEdgeInsetsPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:137:12)
#20 RenderSliverPadding.performLayout (package:flutter/src/rendering/sliver_padding.dart:371:11)
#21 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#22 RenderViewportBase.layoutChildSequence (package:flutter/src/rendering/viewport.dart:510:13)
#23 RenderShrinkWrappingViewport._attemptLayout (package:flutter/src/rendering/viewport.dart:1923:12)
#24 RenderShrinkWrappingViewport.performLayout (package:flutter/src/rendering/viewport.dart:1881:20)
#25 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#26 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#27 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#28 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#29 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#30 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#31 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#32 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#33 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#34 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#35 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#36 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#37 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#38 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#39 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#40 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#41 RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11)
#42 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#43 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#44 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#45 ChildLayoutHelper.layoutChild (package:flutter/src/rendering/layout_helper.dart:56:11)
#46 RenderFlex._computeSizes (package:flutter/src/rendering/flex.dart:829:43)
#47 RenderFlex.performLayout (package:flutter/src/rendering/flex.dart:931:32)
#48 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#49 _RenderSingleChildViewport.performLayout (package:flutter/src/widgets/single_child_scroll_view.dart:581:14)
#50 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#51 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#52 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#53 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#54 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#55 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#56 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#57 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#58 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#59 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#60 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#61 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#62 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#63 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#64 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#65 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#66 RenderCustomPaint.performLayout (package:flutter/src/rendering/custom_paint.dart:545:11)
#67 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#68 RenderProxyBoxMixin.performLayout (package:flutter/src/rendering/proxy_box.dart:116:14)
#69 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#70 RenderPadding.performLayout (package:flutter/src/rendering/shifted_box.dart:233:12)
#71 RenderObject.layout (package:flutter/src/rendering/object.dart:1858:7)
#72 MultiChildLayoutDelegate.layoutChild (package:flutter/src/rendering/custom_layout.dart:171:12)
#73 _ScaffoldLayout.performLayout (package:flutter/src/material/scaffold.dart:1097:7)
#74 MultiChildLayoutDelegate._callPerformLayout (package:flutter/src/rendering/custom_layout.dart:240:7)
#75 RenderCustomMultiChildLayoutBox.performLayout (package:flutter/src/rendering/custom_layout.dart:404:14)
#76 RenderObject._layoutWithoutResize (package:flutter/src/rendering/object.dart:1713:7)
#77 PipelineOwner.flushLayout (package:flutter/src/rendering/object.dart:885:18)
#78 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:453:19)
#79 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
#80 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
#81 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)
#82 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1080:9)
#83 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)
#87 _invoke (dart:ui/hooks.dart:166:10)
#88 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5)
#89 _drawFrame (dart:ui/hooks.dart:129:31)
(elided 3 frames from dart:async)
====================================================================================================
This is the code that the error pops up on:
Widget chatRoomsList() {
return StreamBuilder<dynamic>(
stream: chatRoomsStream,
builder: (context, snapshot) {
return snapshot.hasData
? ListView.builder(
itemCount: snapshot.data.docs.length,
shrinkWrap: true,
itemBuilder: (context, index) {
DocumentSnapshot ds = snapshot.data.docs[index];
return ChatRoomListTile(ds["lastMessage"], ds.id, myUserName);
})
: Center(child: CircularProgressIndicator());
},
);
}
What this snippet of code does is fetch chatrooms that the logged in user has interacted with, on the main page. Sort of like a Messenger Home screen. But if a new user logs in (who has no chatrooms or existing chats with any other user), the main screen should show no results.
What am I doing wrong here? I had a similar problem with my search feature on the same app, and I fixed it by putting in return Streambuilder, but here - that doesn't fix the Bad state error.
The main screen works fine if I log out and log back in, it displays the users I chatted with and their previous/last sent messages.
Kindly help me out here.
EDIT: getChatRooms() [where chatRoomsStream is initialized]:
getChatRooms() async {
chatRoomsStream = await DatabaseMethods().getChatRooms();
setState(() {});
}
DatabaseMethods().getChatRooms() [database.dart method]:
Future<Stream<QuerySnapshot>> getChatRooms() async {
String myUsername = await SharedPreferenceHelper().getUserName();
return FirebaseFirestore.instance
.collection("chatrooms")
.where("users", arrayContains: myUsername)
.snapshots();
}
I believe the issue is in this line
return ChatRoomListTile(ds["lastMessage"], ds.id, myUserName);
try changing this line to ds.data()['lastMessage']
return ChatRoomListTile(ds.data()['lastMessage'], ds.id, myUserName);
Code that worked for me
final usersRef = FirebaseFirestore.instance.collection('users');
final userDocs = await usersRef.get();
final docId =
userDocs.docs.where((doc) => doc.data()['uid'] == user.uid).first.id;
Please lemme know in comments if you any issues, will be glad to help you.
You should use doc.data() but once you use it you will get an error saying operator[] isn't defined for the type Object. That's because in recent version of firestore Document is a generic type and you must also give a type along with it example
DocumentSnapshot<Map<String,dynamic>>
if you don't give any type like this - DocumentSnapshot .The type is inferred as an Object type that doesn't suppose to have "[]" operator defined.
Please look at these two answers for more details-
https://stackoverflow.com/a/63501611/6051666
https://stackoverflow.com/a/69447502/6051666
i am trying to display the image that I am getting as a response from API.
below is the code for displaying the image -:
String ProfilePic;
CircleAvatar(
radius: 80,
backgroundImage:
ProfilePic != null ?
NetworkImage('$ProfilePic'):
// AssetImage('$ProfilePic') :
AssetImage('assets/favicon.png'),
),
As a response, I am getting this data from API -: I/flutter ( 4230): pexels-lisa-1107717.jpg
and when I use it I get following error -:
======== Exception caught by image resource service ================================================
The following ArgumentError was thrown resolving an image codec:
Invalid argument(s): No host specified in URI file:///null
When the exception was thrown, this was the stack:
#0 _HttpClient._openUrl (dart:_http/http_impl.dart:2662:9)
#1 _HttpClient.getUrl (dart:_http/http_impl.dart:2573:48)
#2 NetworkImage._loadAsync (package:flutter/src/painting/_network_image_io.dart:89:59)
#3 NetworkImage.load (package:flutter/src/painting/_network_image_io.dart:50:14)
#4 ImageProvider.resolveStreamForKey.<anonymous closure> (package:flutter/src/painting/image_provider.dart:505:13)
#5 ImageCache.putIfAbsent (package:flutter/src/painting/image_cache.dart:380:22)
#6 ImageProvider.resolveStreamForKey (package:flutter/src/painting/image_provider.dart:503:83)
#7 ImageProvider.resolve.<anonymous closure> (package:flutter/src/painting/image_provider.dart:333:9)
#8 ImageProvider._createErrorHandlerAndKey.<anonymous closure>.<anonymous closure> (package:flutter/src/painting/image_provider.dart:464:26)
#9 SynchronousFuture.then (package:flutter/src/foundation/synchronous_future.dart:41:35)
#10 ImageProvider._createErrorHandlerAndKey.<anonymous closure> (package:flutter/src/painting/image_provider.dart:461:11)
#14 ImageProvider._createErrorHandlerAndKey (package:flutter/src/painting/image_provider.dart:453:16)
#15 ImageProvider.resolve (package:flutter/src/painting/image_provider.dart:330:5)
#16 DecorationImagePainter.paint (package:flutter/src/painting/decoration_image.dart:258:55)
#17 _BoxDecorationPainter._paintBackgroundImage (package:flutter/src/painting/box_decoration.dart:465:20)
#18 _BoxDecorationPainter.paint (package:flutter/src/painting/box_decoration.dart:483:5)
#19 RenderDecoratedBox.paint (package:flutter/src/rendering/proxy_box.dart:2162:17)
#20 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#21 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#22 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#23 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#24 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#25 RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2794:15)
#26 RenderStack.paintStack (package:flutter/src/rendering/stack.dart:629:5)
#27 RenderStack.paint (package:flutter/src/rendering/stack.dart:645:7)
#28 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#29 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#30 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#31 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#32 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#33 RenderShiftedBox.paint (package:flutter/src/rendering/shifted_box.dart:79:15)
#34 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#35 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#36 RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2794:15)
#37 RenderFlex.paint (package:flutter/src/rendering/flex.dart:1078:7)
#38 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#39 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#40 RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2794:15)
#41 RenderFlex.paint (package:flutter/src/rendering/flex.dart:1078:7)
#42 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#43 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#44 RenderProxyBoxMixin.paint (package:flutter/src/rendering/proxy_box.dart:140:15)
#45 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#46 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#47 RenderBoxContainerDefaultsMixin.defaultPaint (package:flutter/src/rendering/box.dart:2794:15)
#48 RenderFlex.paint (package:flutter/src/rendering/flex.dart:1078:7)
#49 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#50 PaintingContext.paintChild (package:flutter/src/rendering/object.dart:189:13)
#51 _RenderSingleChildViewport.paint.paintContents (package:flutter/src/widgets/single_child_scroll_view.dart:619:17)
#52 PaintingContext.pushLayer (package:flutter/src/rendering/object.dart:398:12)
#53 PaintingContext.pushClipRect (package:flutter/src/rendering/object.dart:454:7)
#54 _RenderSingleChildViewport.paint (package:flutter/src/widgets/single_child_scroll_view.dart:623:40)
#55 RenderObject._paintWithContext (package:flutter/src/rendering/object.dart:2409:7)
#56 PaintingContext._repaintCompositedChild (package:flutter/src/rendering/object.dart:141:11)
#57 PaintingContext.repaintCompositedChild (package:flutter/src/rendering/object.dart:100:5)
#58 PipelineOwner.flushPaint (package:flutter/src/rendering/object.dart:979:29)
#59 RendererBinding.drawFrame (package:flutter/src/rendering/binding.dart:455:19)
#60 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:883:13)
#61 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:319:5)
#62 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1143:15)
#63 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1080:9)
#64 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:996:5)
#68 _invoke (dart:ui/hooks.dart:166:10)
#69 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:270:5)
#70 _drawFrame (dart:ui/hooks.dart:129:31)
(elided 6 frames from dart:async)
Image provider: NetworkImage("null", scale: 1.0)
Image key: NetworkImage("null", scale: 1.0)
====================================================================================================
i have used network image but still, I am not able to display the image. i have tried other solutions too but nothing seems to work.
can anyone help me with displaying this?
Your check is wrong it should be this way
ProfilePic != null ? NetworkImage('$ProfilePic'):AssetImage('assets/favicon.png'),
I have tried many ways to solve it in the last 3 days, but nothing worked. Has anyone experienced it too?
Dart analysis issue
NoSuchMethodError: The setter 'type=' was called on null.
Version information
Dart SDK 2.12.2
Dart IntelliJ 201.9335
Android Studio 4.1.3
Windows 10 10.0
Details
NoSuchMethodError: The setter 'type=' was called on null.
Receiver: null
Tried calling: type=Instance of 'InterfaceTypeImpl'
#0 Object.noSuchMethod (dart:core-patch/object_patch.dart:54:5)
#1 Null.type= (dart:core/null.dart:1:1)
#2 ApplyResolutionVisitor.visitVariableDeclaration (package:analyzer/src/summary2/apply_resolution.dart:1327:13)
#3 VariableDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:10555:49)
#4 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#5 ApplyResolutionVisitor.visitVariableDeclarationList (package:analyzer/src/summary2/apply_resolution.dart:1345:20)
#6 VariableDeclarationListImpl.accept (package:analyzer/src/dart/ast/ast.dart:10655:15)
#7 ApplyResolutionVisitor.visitTopLevelVariableDeclaration (package:analyzer/src/summary2/apply_resolution.dart:1231:20)
#8 TopLevelVariableDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:9909:15)
#9 LinkedContext.applyResolution (package:analyzer/src/summary2/bundle_reader.dart:512:11)
#10 LinkedUnitContext.applyResolution (package:analyzer/src/summary2/linked_unit_context.dart:93:25)
#11 PropertyInducingElementImpl.typeInternal (package:analyzer/src/dart/element/element.dart:6731:21)
#12 ElementTypeProvider.getFieldType (package:analyzer/src/generated/element_type_provider.dart:62:15)
#13 PropertyInducingElementImpl.type (package:analyzer/src/dart/element/element.dart:6724:52)
#14 PropertyAccessorElementImpl_ImplicitGetter.returnTypeInternal (package:analyzer/src/dart/element/element.dart:6579:47)
#15 ElementTypeProvider.getExecutableReturnType (package:analyzer/src/generated/element_type_provider.dart:49:15)
#16 PropertyAccessorElementImpl_ImplicitGetter.returnType (package:analyzer/src/dart/element/element.dart:6571:35)
#17 PropertyAccessorElementImpl_ImplicitGetter.typeInternal (package:analyzer/src/dart/element/element.dart:6596:19)
#18 ElementTypeProvider.getExecutableType (package:analyzer/src/generated/element_type_provider.dart:55:15)
#19 PropertyAccessorElementImpl_ImplicitGetter.type (package:analyzer/src/dart/element/element.dart:6582:56)
#20 SimpleIdentifierResolver._getTypeOfProperty (package:analyzer/src/dart/resolver/simple_identifier_resolver.dart:52:42)
#21 SimpleIdentifierResolver._resolve2 (package:analyzer/src/dart/resolver/simple_identifier_resolver.dart:257:20)
#22 SimpleIdentifierResolver.resolve (package:analyzer/src/dart/resolver/simple_identifier_resolver.dart:42:5)
#23 ResolverVisitor.visitSimpleIdentifier (package:analyzer/src/generated/resolver.dart:1863:51)
#24 SimpleIdentifierImpl.accept (package:analyzer/src/dart/ast/ast.dart:8970:49)
#25 ResolverVisitor.visitArgumentList (package:analyzer/src/generated/resolver.dart:887:20)
#26 ArgumentListImpl.accept (package:analyzer/src/dart/ast/ast.dart:355:49)
#27 MethodInvocationResolver._resolveArguments (package:analyzer/src/dart/resolver/method_invocation_resolver.dart:291:23)
#28 MethodInvocationResolver._resolveArguments_finishInference (package:analyzer/src/dart/resolver/method_invocation_resolver.dart:295:5)
#29 MethodInvocationResolver._setDynamicResolution (package:analyzer/src/dart/resolver/method_invocation_resolver.dart:782:5)
#30 MethodInvocationResolver._resolveReceiverType (package:analyzer/src/dart/resolver/method_invocation_resolver.dart:675:5)
#31 MethodInvocationResolver._resolveReceiverNull (package:analyzer/src/dart/resolver/method_invocation_resolver.dart:542:5)
#32 MethodInvocationResolver.resolve (package:analyzer/src/dart/resolver/method_invocation_resolver.dart:93:7)
#33 ElementResolver.visitMethodInvocation (package:analyzer/src/generated/element_resolver.dart:394:31)
#34 MethodInvocationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7186:49)
#35 ResolverVisitor.visitMethodInvocation (package:analyzer/src/generated/resolver.dart:1706:10)
#36 MethodInvocationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7186:49)
#37 AwaitExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:902:18)
#38 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#39 UnifyingAstVisitor.visitAwaitExpression (package:analyzer/dart/ast/visitor.dart:3137:51)
#40 ResolverVisitor.visitAwaitExpression (package:analyzer/src/generated/resolver.dart:944:11)
#41 AwaitExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:898:49)
#42 ExpressionStatementImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:3680:18)
#43 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#44 UnifyingAstVisitor.visitExpressionStatement (package:analyzer/dart/ast/visitor.dart:3229:59)
#45 ExpressionStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:3676:49)
#46 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#47 BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1087:17)
#48 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#49 UnifyingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:3143:31)
#50 ScopedVisitor.visitBlock.<anonymous closure> (package:analyzer/src/generated/resolver.dart:2480:13)
#51 ScopedVisitor._withDeclaredLocals (package:analyzer/src/generated/resolver.dart:3076:8)
#52 ScopedVisitor.visitBlock (package:analyzer/src/generated/resolver.dart:2479:5)
#53 BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1083:49)
#54 BlockFunctionBodyImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1042:13)
#55 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#56 UnifyingAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:3146:55)
#57 ScopedVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:2489:13)
#58 ResolverVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:957:13)
#59 BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1038:49)
#60 FunctionExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:5010:12)
#61 FunctionExpressionResolver.resolve (package:analyzer/src/dart/resolver/function_expression_resolver.dart:65:10)
#62 ResolverVisitor.visitFunctionExpression (package:analyzer/src/generated/resolver.dart:1460:37)
#63 FunctionExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:5004:49)
#64 NamedExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7385:18)
#65 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#66 UnifyingAstVisitor.visitNamedExpression (package:analyzer/dart/ast/visitor.dart:3360:51)
#67 ResolverVisitor.visitNamedExpression (package:analyzer/src/generated/resolver.dart:1744:11)
#68 NamedExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:7380:49)
#69 ResolverVisitor.visitArgumentList (package:analyzer/src/generated/resolver.dart:887:20)
#70 ArgumentListImpl.accept (package:analyzer/src/dart/ast/ast.dart:355:49)
#71 ResolverVisitor.visitInstanceCreationExpression (package:analyzer/src/generated/resolver.dart:1621:24)
#72 InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:6130:15)
#73 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#74 ListLiteralImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:6762:15)
#75 TypedLiteralResolver.resolveListLiteral (package:analyzer/src/dart/resolver/typed_literal_resolver.dart:97:10)
#76 ResolverVisitor.visitListLiteral (package:analyzer/src/generated/resolver.dart:1648:27)
#77 ListLiteralImpl.accept (package:analyzer/src/dart/ast/ast.dart:6757:49)
#78 NamedExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7385:18)
#79 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#80 UnifyingAstVisitor.visitNamedExpression (package:analyzer/dart/ast/visitor.dart:3360:51)
#81 ResolverVisitor.visitNamedExpression (package:analyzer/src/generated/resolver.dart:1744:11)
#82 NamedExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:7380:49)
#83 ResolverVisitor.visitArgumentList (package:analyzer/src/generated/resolver.dart:887:20)
#84 ArgumentListImpl.accept (package:analyzer/src/dart/ast/ast.dart:355:49)
#85 ResolverVisitor.visitInstanceCreationExpression (package:analyzer/src/generated/resolver.dart:1621:24)
#86 InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:6130:15)
#87 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#88 ListLiteralImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:6762:15)
#89 TypedLiteralResolver.resolveListLiteral (package:analyzer/src/dart/resolver/typed_literal_resolver.dart:97:10)
#90 ResolverVisitor.visitListLiteral (package:analyzer/src/generated/resolver.dart:1648:27)
#91 ListLiteralImpl.accept (package:analyzer/src/dart/ast/ast.dart:6757:49)
#92 NamedExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7385:18)
#93 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#94 UnifyingAstVisitor.visitNamedExpression (package:analyzer/dart/ast/visitor.dart:3360:51)
#95 ResolverVisitor.visitNamedExpression (package:analyzer/src/generated/resolver.dart:1744:11)
#96 NamedExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:7380:49)
#97 ResolverVisitor.visitArgumentList (package:analyzer/src/generated/resolver.dart:887:20)
#98 ArgumentListImpl.accept (package:analyzer/src/dart/ast/ast.dart:355:49)
#99 ResolverVisitor.visitInstanceCreationExpression (package:analyzer/src/generated/resolver.dart:1621:24)
#100 InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:6130:15)
#101 NamedExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7385:18)
#102 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#103 UnifyingAstVisitor.visitNamedExpression (package:analyzer/dart/ast/visitor.dart:3360:51)
#104 ResolverVisitor.visitNamedExpression (package:analyzer/src/generated/resolver.dart:1744:11)
#105 NamedExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:7380:49)
#106 ResolverVisitor.visitArgumentList (package:analyzer/src/generated/resolver.dart:887:20)
#107 ArgumentListImpl.accept (package:analyzer/src/dart/ast/ast.dart:355:49)
#108 ResolverVisitor.visitInstanceCreationExpression (package:analyzer/src/generated/resolver.dart:1621:24)
#109 InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:6130:15)
#110 NamedExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7385:18)
#111 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#112 UnifyingAstVisitor.visitNamedExpression (package:analyzer/dart/ast/visitor.dart:3360:51)
#113 ResolverVisitor.visitNamedExpression (package:analyzer/src/generated/resolver.dart:1744:11)
#114 NamedExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:7380:49)
#115 ResolverVisitor.visitArgumentList (package:analyzer/src/generated/resolver.dart:887:20)
#116 ArgumentListImpl.accept (package:analyzer/src/dart/ast/ast.dart:355:49)
#117 ResolverVisitor.visitInstanceCreationExpression (package:analyzer/src/generated/resolver.dart:1621:24)
#118 InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:6130:15)
#119 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#120 ListLiteralImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:6762:15)
#121 TypedLiteralResolver.resolveListLiteral (package:analyzer/src/dart/resolver/typed_literal_resolver.dart:97:10)
#122 ResolverVisitor.visitListLiteral (package:analyzer/src/generated/resolver.dart:1648:27)
#123 ListLiteralImpl.accept (package:analyzer/src/dart/ast/ast.dart:6757:49)
#124 NamedExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7385:18)
#125 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#126 UnifyingAstVisitor.visitNamedExpression (package:analyzer/dart/ast/visitor.dart:3360:51)
#127 ResolverVisitor.visitNamedExpression (package:analyzer/src/generated/resolver.dart:1744:11)
#128 NamedExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:7380:49)
#129 ResolverVisitor.visitArgumentList (package:analyzer/src/generated/resolver.dart:887:20)
#130 ArgumentListImpl.accept (package:analyzer/src/dart/ast/ast.dart:355:49)
#131 ResolverVisitor.visitInstanceCreationExpression (package:analyzer/src/generated/resolver.dart:1621:24)
#132 InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:6130:15)
#133 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#134 ListLiteralImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:6762:15)
#135 TypedLiteralResolver.resolveListLiteral (package:analyzer/src/dart/resolver/typed_literal_resolver.dart:97:10)
#136 ResolverVisitor.visitListLiteral (package:analyzer/src/generated/resolver.dart:1648:27)
#137 ListLiteralImpl.accept (package:analyzer/src/dart/ast/ast.dart:6757:49)
#138 NamedExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7385:18)
#139 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#140 UnifyingAstVisitor.visitNamedExpression (package:analyzer/dart/ast/visitor.dart:3360:51)
#141 ResolverVisitor.visitNamedExpression (package:analyzer/src/generated/resolver.dart:1744:11)
#142 NamedExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:7380:49)
#143 ResolverVisitor.visitArgumentList (package:analyzer/src/generated/resolver.dart:887:20)
#144 ArgumentListImpl.accept (package:analyzer/src/dart/ast/ast.dart:355:49)
#145 ResolverVisitor.visitInstanceCreationExpression (package:analyzer/src/generated/resolver.dart:1621:24)
#146 InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:6130:15)
#147 NamedExpressionImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7385:18)
#148 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#149 UnifyingAstVisitor.visitNamedExpression (package:analyzer/dart/ast/visitor.dart:3360:51)
#150 ResolverVisitor.visitNamedExpression (package:analyzer/src/generated/resolver.dart:1744:11)
#151 NamedExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:7380:49)
#152 ResolverVisitor.visitArgumentList (package:analyzer/src/generated/resolver.dart:887:20)
#153 ArgumentListImpl.accept (package:analyzer/src/dart/ast/ast.dart:355:49)
#154 ResolverVisitor.visitInstanceCreationExpression (package:analyzer/src/generated/resolver.dart:1621:24)
#155 InstanceCreationExpressionImpl.accept (package:analyzer/src/dart/ast/ast.dart:6130:15)
#156 ReturnStatementImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:8621:18)
#157 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#158 UnifyingAstVisitor.visitReturnStatement (package:analyzer/dart/ast/visitor.dart:3410:51)
#159 ResolverVisitor.visitReturnStatement (package:analyzer/src/generated/resolver.dart:1846:11)
#160 ReturnStatementImpl.accept (package:analyzer/src/dart/ast/ast.dart:8617:49)
#161 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#162 BlockImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1087:17)
#163 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#164 UnifyingAstVisitor.visitBlock (package:analyzer/dart/ast/visitor.dart:3143:31)
#165 ScopedVisitor.visitBlock.<anonymous closure> (package:analyzer/src/generated/resolver.dart:2480:13)
#166 ScopedVisitor._withDeclaredLocals (package:analyzer/src/generated/resolver.dart:3076:8)
#167 ScopedVisitor.visitBlock (package:analyzer/src/generated/resolver.dart:2479:5)
#168 BlockImpl.accept (package:analyzer/src/dart/ast/ast.dart:1083:49)
#169 BlockFunctionBodyImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:1042:13)
#170 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#171 UnifyingAstVisitor.visitBlockFunctionBody (package:analyzer/dart/ast/visitor.dart:3146:55)
#172 ScopedVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:2489:13)
#173 ResolverVisitor.visitBlockFunctionBody (package:analyzer/src/generated/resolver.dart:957:13)
#174 BlockFunctionBodyImpl.accept (package:analyzer/src/dart/ast/ast.dart:1038:49)
#175 MethodDeclarationImpl.visitChildren (package:analyzer/src/dart/ast/ast.dart:7042:12)
#176 ResolverVisitor.visitNode (package:analyzer/src/generated/resolver.dart:1750:10)
#177 UnifyingAstVisitor.visitMethodDeclaration (package:analyzer/dart/ast/visitor.dart:3351:55)
#178 ScopedVisitor.visitMethodDeclarationInScope (package:analyzer/src/generated/resolver.dart:2926:11)
#179 ScopedVisitor.visitMethodDeclaration (package:analyzer/src/generated/resolver.dart:2919:7)
#180 ResolverVisitor.visitMethodDeclaration (package:analyzer/src/generated/resolver.dart:1666:11)
#181 MethodDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:7033:49)
#182 NodeListImpl.accept (package:analyzer/src/dart/ast/ast.dart:7611:20)
#183 ScopedVisitor.visitClassMembersInScope (package:analyzer/src/generated/resolver.dart:2550:18)
#184 ScopedVisitor.visitClassDeclaration (package:analyzer/src/generated/resolver.dart:2531:7)
#185 ResolverVisitor.visitClassDeclaration (package:analyzer/src/generated/resolver.dart:1015:13)
#186 ClassDeclarationImpl.accept (package:analyzer/src/dart/ast/ast.dart:1536:49)
#187 ResolverVisitor.visitCompilationUnit (package:analyzer/src/generated/resolver.dart:1091:23)
#188 CompilationUnitImpl.accept (package:analyzer/src/dart/ast/ast.dart:2134:49)
#189 LibraryAnalyzer._resolveFile (package:analyzer/src/dart/analysis/library_analyzer.dart:709:10)
#190 LibraryAnalyzer.analyzeSync.<anonymous closure> (package:analyzer/src/dart/analysis/library_analyzer.dart:139:7)
#191 _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:397:8)
#192 LibraryAnalyzer.analyzeSync (package:analyzer/src/dart/analysis/library_analyzer.dart:138:11)
#193 LibraryAnalyzer.analyze (package:analyzer/src/dart/analysis/library_analyzer.dart:107:12)
#194 AnalysisDriver._computeAnalysisResult2.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1319:63)
#195 PerformanceLog.run (package:analyzer/src/dart/analysis/performance_logger.dart:32:15)
#196 AnalysisDriver._computeAnalysisResult2 (package:analyzer/src/dart/analysis/driver.dart:1296:20)
#197 AnalysisDriver._computeAnalysisResult.<anonymous closure> (package:analyzer/src/dart/analysis/driver.dart:1249:14)
#198 _rootRun (dart:async/zone.dart:1354:13)
#199 _CustomZone.run (dart:async/zone.dart:1258:19)
#200 _runZoned (dart:async/zone.dart:1788:10)
#201 runZoned (dart:async/zone.dart:1710:10)
#202 NullSafetyUnderstandingFlag.enableNullSafetyTypes (package:analyzer/dart/element/null_safety_understanding_flag.dart:42:12)
#203 AnalysisDriver._computeAnalysisResult (package:analyzer/src/dart/analysis/driver.dart:1248:40)
#204 AnalysisDriver._computeIndex (package:analyzer/src/dart/analysis/driver.dart:1386:37)
#205 AnalysisDriver.performWork (package:analyzer/src/dart/analysis/driver.dart:995:39)
#206 AnalysisDriverScheduler._run (package:analyzer/src/dart/analysis/driver.dart:2018:24)
<asynchronous suspension>
#0 Driver._captureExceptions.errorFunction (package:analysis_server/src/server/driver.dart:480:7)
#1 _CustomZone.handleUncaughtError (dart:async/zone.dart:1241:19)
#2 _CustomZone.runGuarded (dart:async/zone.dart:1164:7)
#3 _CustomZone.bindCallbackGuarded.<anonymous closure> (dart:async/zone.dart:1202:23)
#4 _microtaskLoop (dart:async/schedule_microtask.dart:40:21)
#5 _startMicrotaskLoop (dart:async/schedule_microtask.dart:49:5)
#6 _runPendingImmediateCallback (dart:isolate-patch/isolate_patch.dart:120:13)
#7 _Timer._runTimers (dart:isolate-patch/timer_impl.dart:402:11)
#8 _RawReceivePortImpl._handleMessage (dart:isolate-patch/isolate_patch.dart:184:12)
Debug log
1617529296421 => {"id":"1198","method":"analysis.updateContent","params":{"files":{"C:\\Users\\krish\\AndroidStudioProjects\\smart_vendor\\lib\\screens\\detail_order_screen.dart":{"type":"add","conten...
1617529296421 <= {"id":"1198","result":{}}
1617529296421 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1617529296452 => {"id":"1199","method":"edit.getAssists","params":{"file":"C:\\Users\\krish\\AndroidStudioProjects\\smart_vendor\\lib\\screens\\detail_order_screen.dart","offset":124,"length":0},"clie...
1617529296608 <= {"id":"1199","result":{"assists":[]}}
1617529296608 <= {"event":"completion.availableSuggestions","params":{"changedLibraries":[{"id":982,"uri":"package:smart_vendor/screens/screens.dart","items":[{"label":"IllustrationPage","declaringLib...
1617529296608 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
1617529297046 => {"id":"1200","method":"analysis.updateContent","params":{"files":{"C:\\Users\\krish\\AndroidStudioProjects\\smart_vendor\\lib\\screens\\detail_order_screen.dart":{"type":"add","conten...
1617529297046 <= {"id":"1200","result":{}}
1617529297046 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1617529297077 => {"id":"1201","method":"edit.getAssists","params":{"file":"C:\\Users\\krish\\AndroidStudioProjects\\smart_vendor\\lib\\screens\\detail_order_screen.dart","offset":123,"length":0},"clie...
1617529297216 <= {"id":"1201","result":{"assists":[]}}
1617529297232 <= {"event":"completion.availableSuggestions","params":{"changedLibraries":[{"id":982,"uri":"package:smart_vendor/screens/screens.dart","items":[{"label":"IllustrationPage","declaringLib...
1617529297232 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
1617529299111 => {"id":"1202","method":"edit.getAssists","params":{"file":"C:\\Users\\krish\\AndroidStudioProjects\\smart_vendor\\lib\\screens\\detail_order_screen.dart","offset":261,"length":8},"clie...
1617529299173 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1617529299173 <= {"id":"1202","result":{"assists":[]}}
1617529299173 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
1617529300705 => {"id":"1203","method":"analysis.setPriorityFiles","params":{"files":["C:\\Developments\\flutter\\packages\\flutter\\lib\\src\\widgets\\framework.dart"]},"clientRequestTime":1617529300...
1617529300705 => {"id":"1204","method":"analysis.setSubscriptions","params":{"subscriptions":{"OVERRIDES":["C:\\Developments\\flutter\\packages\\flutter\\lib\\src\\widgets\\framework.dart"],"CLOSING_L...
1617529300705 <= {"id":"1203"}
1617529300705 <= {"id":"1204"}
1617529300830 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":true}}}
1617529300845 <= {"event":"analysis.highlights","params":{"file":"C:\\Developments\\flutter\\packages\\flutter\\lib\\src\\widgets\\framework.dart","regions":[{"type":"DIRECTIVE","offset":169,"length":...
1617529300861 <= {"event":"analysis.navigation","params":{"file":"C:\\Developments\\flutter\\packages\\flutter\\lib\\src\\widgets\\framework.dart","regions":[{"offset":176,"length":12,"targets":[0]},{...
1617529300861 <= {"event":"analysis.closingLabels","params":{"file":"C:\\Developments\\flutter\\packages\\flutter\\lib\\src\\widgets\\framework.dart","labels":[{"offset":9145,"length":486,"label":"Flu...
1617529300876 <= {"event":"analysis.outline","params":{"file":"C:\\Developments\\flutter\\packages\\flutter\\lib\\src\\widgets\\framework.dart","kind":"LIBRARY","outline":{"element":{"kind":"COMPILATI...
1617529300876 <= {"event":"analysis.overrides","params":{"file":"C:\\Developments\\flutter\\packages\\flutter\\lib\\src\\widgets\\framework.dart","overrides":[{"offset":2033,"length":8,"superclassMemb...
1617529300892 <= {"event":"flutter.outline","params":{"file":"C:\\Developments\\flutter\\packages\\flutter\\lib\\src\\widgets\\framework.dart","outline":{"kind":"DART_ELEMENT","offset":0,"length":2660...
1617529300892 <= {"event":"server.status","params":{"analysis":{"isAnalyzing":false}}}
This is one of some files that caused this exception:
library screens;
import 'package:flutter_bloc/flutter_bloc.dart';
import 'package:get/get.dart';
import 'package:flutter/material.dart';
import 'package:smart_vendor/lang/lang.dart';
import 'package:smart_vendor/cubit/cubit.dart';
import 'package:smart_vendor/models/models.dart';
import 'package:smart_vendor/shared/shared.dart';
import 'package:smart_vendor/widgets/widgets.dart';
part 'address_page.dart';
part 'general_page.dart';
part 'sign_in_page.dart';
part 'sign_up_page.dart';
part 'sign_up_agent_page.dart';
part 'sign_up_personal_page.dart';
part 'sign_up_business_page.dart';
part 'main_page.dart';
part 'profile_page.dart';
part 'history_page.dart';
part 'illustration_page.dart';
part 'filter_page.dart';
part 'success_page.dart';
part 'success_sign_up_page.dart';
part 'take_order_confirmation_page.dart';
part 'detail_order_screen.dart';