OpenFlutter / flutter_screenutil

Flutter screen adaptation, font adaptation, get screen information
https://pub.dartlang.org/packages/flutter_screenutil
Apache License 2.0
3.87k stars 493 forks source link

Get LateInitializationError: Field 'dashboardTitleValue' has not been initialized on iOS simulator #436

Closed zhgchen closed 1 year ago

zhgchen commented 1 year ago

When I click any dashboard get LateInitializationError: Field 'dashboardTitleValue' has not been initialized.

App start from iOS simulator, throw below error

=========Exception caught by widgets library======================= The following assertion was thrown building Builder: dependOnInheritedWidgetOfExactType<_LocalizationsScope>() or dependOnInheritedElement() was called before _MainDashboardPageState.initState() completed. When an inherited widget changes, for example if the value of Theme.of() changes, its dependent widgets are rebuilt. If the dependent widget's reference to the inherited widget is in a constructor or an initState() method, then the rebuilt dependent widget will not reflect the changes in the inherited widget. Typically references to inherited widgets should occur in widget build() methods. Alternatively, initialization based on inherited widgets can be placed in the didChangeDependencies method, which is called after initState and whenever the dependencies change thereafter. the relevant error-causing widget was: FadeTransition FadeTransition:file:///Users/chenzhongguo/Dev/flutter_thingsboard_app_home/lib/utils/transition/page_transitions.dart:48:14 When the exception was thrown, this was the stack: 0 StatefulElement.dependOnInheritedElement. (package:flutter/src/widgets/framework.dart:5130:9) 1 StatefulElement.dependOnInheritedElement (package:flutter/src/widgets/framework.dart:5173:6) 2 Element.dependOnInheritedWidgetOfExactType (package:flutter/src/widgets/framework.dart:4278:14) 3 Localizations.of (package:flutter/src/widgets/localizations.dart:472:48) 4 S.maybeOf (package:thingsboard_app/generated/l10n.dart:50:26) 5 S.of (package:thingsboard_app/generated/l10n.dart:43:24) 6 _MainDashboardPageState.initState (package:thingsboard_app/modules/dashboard/main_dashboard_page.dart:81:69) 7 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5015:57) 8 ComponentElement.mount (package:flutter/src/widgets/framework.dart:4853:5) ... Normal element mounting (171 frames) 179 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3863:16) 180 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6435:36) 181 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6447:32) ... Normal element mounting (176 frames) 357 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3863:16) 358 Element.updateChild (package:flutter/src/widgets/framework.dart:3586:20) 359 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4904:16) 360 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5050:11) 361 Element.rebuild (package:flutter/src/widgets/framework.dart:4604:5) 362 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2667:19) 363 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:882:21) 364 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:378:5) 365 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1175:15) 366 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1104:9) 367 SchedulerBinding.scheduleWarmUpFrame. (package:flutter/src/scheduler/binding.dart:881:7) (elided 4 frames from class _RawReceivePortImpl, class _Timer, and dart:async-patch)

flutter: DEBUG ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG │ 🐛 onUserLoaded: isAuthenticated=true flutter: DEBUG └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG │ 🐛 authUser: AuthUser..........exp: 1666928529} flutter: DEBUG └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG │ 🐛 On load started. flutter: DEBUG └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG │ 🐛 On load finished. flutter: DEBUG └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG │ 🐛 On load started. flutter: DEBUG └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG │ 🐛 On load finished. flutter: DEBUG └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG │ 🐛 On load started. flutter: DEBUG └─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG ┌─────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────── flutter: DEBUG │ 🐛 On load finished. flutter: DEBUG └───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Open dashboard from iOS simulator, throw below error

[VERBOSE-2:dart_vm_initializer.cc(41)] Unhandled Exception: LateInitializationError: Field 'dashboardTitleValue' has not been initialized. 0 _MainDashboardPageState.dashboardTitleValue (package:thingsboard_app/modules/dashboard/main_dashboard_page.dart) 1 _MainDashboardPageState._updateTitle (package:thingsboard_app/modules/dashboard/main_dashboard_page.dart:91:5) 2 MainDashboardPageController.openDashboard (package:thingsboard_app/modules/dashboard/main_dashboard_page.dart:32:32) 3 ThingsboardAppState.navigateToDashboard (package:thingsboard_app/main.dart:133:40) 4 TbContext.navigateToDashboard (package:thingsboard_app/core/context/tb_context.dart:456:33) 5 HasTbContext.navigateToDashboard (package:thingsboard_app/core/context/tb_context.dart:588:18) 6 DashboardsBase.onEntityTap (package:thingsboard_app/modules/dashboard/dashboards_base.dart:35:5) 7 EntityGridCard.build. (package:thingsboard_app/core/entity/entity_grid_card.dart:47:2<…>

lizhuoyuan commented 1 year ago

这我看 好像是不是这个库的问题啊 建议再看看