[GH-ISSUE #3568] [Bug] Null promise used on null value #1613

Closed
opened 2026-03-23 20:51:42 +00:00 by mirror · 0 comments
Owner

Originally created by @Xazin on GitHub (Oct 1, 2023).
Original GitHub issue: https://github.com/AppFlowy-IO/AppFlowy/issues/3568

Originally assigned to: @Xazin on GitHub.

Bug Description

This exception is thrown when starting up the latest version of main in development environment.

This is due to the not-null promise for workspaceSetting in appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart on line 63:

            BlocProvider<HomeBloc>(
              create: (context) {
                return HomeBloc(userProfile, workspaceSetting!)
                  ..add(const HomeEvent.initial());
              },
            ),

Expand the spoiler below to see the exception log, due to the size it's in a spoiler.

Exception log
══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════
The following _TypeError was thrown building _NestedHook:
Null check operator used on a null value

The relevant error-causing widget was:
  MultiBlocListener
  MultiBlocListener:file:///Users/mathias/Development/AppFlowy/frontend/appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart:79:21

When the exception was thrown, this was the stack:
#0      DesktopHomeScreen.build.<anonymous closure>.<anonymous closure> (package:appflowy/workspace/presentation/home/desktop_home_screen.dart:63:62)
#1      _CreateInheritedProviderState.value (package:provider/src/inherited_provider.dart:736:36)
#2      _InheritedProviderScopeElement.value (package:provider/src/inherited_provider.dart:590:33)
#3      Provider.of (package:provider/src/provider.dart:303:37)
#4      ReadContext.read (package:provider/src/provider.dart:649:21)
#5      _BlocListenerBaseState.initState (package:flutter_bloc/src/bloc_listener.dart:143:36)
#6      StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5219:55)
#7      ComponentElement.mount (package:flutter/src/widgets/framework.dart:5062:5)
#8      SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11)
...     Normal element mounting (7 frames)
#15     _NestedHookElement.mount (package:nested/nested.dart:187:11)
...     Normal element mounting (7 frames)
#22     SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11)
...     Normal element mounting (25 frames)
#47     Element.inflateWidget (package:flutter/src/widgets/framework.dart:3971:16)
#48     MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6570:36)
#49     MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6582:32)
...     Normal element mounting (117 frames)
#166    _InheritedProviderScopeElement.mount (package:provider/src/inherited_provider.dart:411:11)
...     Normal element mounting (7 frames)
#173    SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11)
...     Normal element mounting (7 frames)
#180    SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11)
...     Normal element mounting (7 frames)
#187    _NestedHookElement.mount (package:nested/nested.dart:187:11)
...     Normal element mounting (7 frames)
#194    _InheritedProviderScopeElement.mount (package:provider/src/inherited_provider.dart:411:11)
...     Normal element mounting (7 frames)
#201    SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11)
...     Normal element mounting (7 frames)
#208    SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11)
...     Normal element mounting (7 frames)
#215    _NestedHookElement.mount (package:nested/nested.dart:187:11)
...     Normal element mounting (7 frames)
#222    _InheritedProviderScopeElement.mount (package:provider/src/inherited_provider.dart:411:11)
...     Normal element mounting (7 frames)
#229    SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11)
...     Normal element mounting (7 frames)
#236    SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11)
...     Normal element mounting (7 frames)
#243    _NestedHookElement.mount (package:nested/nested.dart:187:11)
...     Normal element mounting (7 frames)
#250    SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11)
#251    Element.inflateWidget (package:flutter/src/widgets/framework.dart:3971:16)
#252    Element.updateChild (package:flutter/src/widgets/framework.dart:3702:20)
#253    ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5111:16)
#254    StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5251:11)
#255    Element.rebuild (package:flutter/src/widgets/framework.dart:4805:7)
#256    BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2780:19)
#257    WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:903:21)
#258    RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:358:5)
#259    SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1284:15)
#260    SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1214:9)
#261    SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1072:5)
#262    _invoke (dart:ui/hooks.dart:142:13)
#263    PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:359:5)
#264    _drawFrame (dart:ui/hooks.dart:112:31)

════════════════════════════════════════════════════════════════════════════════════════════════════

How to Reproduce

  1. Open AppFlowy (Eg. from release, or build and run appflowy)
  2. Build and run AppFlowy from Dev Environment (You can run two instances easily from dev environment as well)

Expected Behavior

App doesn't crash / no red-screen

Operating System

MacOS

AppFlowy Version(s)

main

Screenshots

No response

Additional Context

No response

Originally created by @Xazin on GitHub (Oct 1, 2023). Original GitHub issue: https://github.com/AppFlowy-IO/AppFlowy/issues/3568 Originally assigned to: @Xazin on GitHub. ### Bug Description This exception is thrown when starting up the latest version of main in development environment. This is due to the not-null promise for `workspaceSetting` in `appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart` on line 63: ``` BlocProvider<HomeBloc>( create: (context) { return HomeBloc(userProfile, workspaceSetting!) ..add(const HomeEvent.initial()); }, ), ``` Expand the spoiler below to see the exception log, due to the size it's in a spoiler. <details> <summary>Exception log</summary> ``` ══╡ EXCEPTION CAUGHT BY WIDGETS LIBRARY ╞═══════════════════════════════════════════════════════════ The following _TypeError was thrown building _NestedHook: Null check operator used on a null value The relevant error-causing widget was: MultiBlocListener MultiBlocListener:file:///Users/mathias/Development/AppFlowy/frontend/appflowy_flutter/lib/workspace/presentation/home/desktop_home_screen.dart:79:21 When the exception was thrown, this was the stack: #0 DesktopHomeScreen.build.<anonymous closure>.<anonymous closure> (package:appflowy/workspace/presentation/home/desktop_home_screen.dart:63:62) #1 _CreateInheritedProviderState.value (package:provider/src/inherited_provider.dart:736:36) #2 _InheritedProviderScopeElement.value (package:provider/src/inherited_provider.dart:590:33) #3 Provider.of (package:provider/src/provider.dart:303:37) #4 ReadContext.read (package:provider/src/provider.dart:649:21) #5 _BlocListenerBaseState.initState (package:flutter_bloc/src/bloc_listener.dart:143:36) #6 StatefulElement._firstBuild (package:flutter/src/widgets/framework.dart:5219:55) #7 ComponentElement.mount (package:flutter/src/widgets/framework.dart:5062:5) #8 SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11) ... Normal element mounting (7 frames) #15 _NestedHookElement.mount (package:nested/nested.dart:187:11) ... Normal element mounting (7 frames) #22 SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11) ... Normal element mounting (25 frames) #47 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3971:16) #48 MultiChildRenderObjectElement.inflateWidget (package:flutter/src/widgets/framework.dart:6570:36) #49 MultiChildRenderObjectElement.mount (package:flutter/src/widgets/framework.dart:6582:32) ... Normal element mounting (117 frames) #166 _InheritedProviderScopeElement.mount (package:provider/src/inherited_provider.dart:411:11) ... Normal element mounting (7 frames) #173 SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11) ... Normal element mounting (7 frames) #180 SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11) ... Normal element mounting (7 frames) #187 _NestedHookElement.mount (package:nested/nested.dart:187:11) ... Normal element mounting (7 frames) #194 _InheritedProviderScopeElement.mount (package:provider/src/inherited_provider.dart:411:11) ... Normal element mounting (7 frames) #201 SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11) ... Normal element mounting (7 frames) #208 SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11) ... Normal element mounting (7 frames) #215 _NestedHookElement.mount (package:nested/nested.dart:187:11) ... Normal element mounting (7 frames) #222 _InheritedProviderScopeElement.mount (package:provider/src/inherited_provider.dart:411:11) ... Normal element mounting (7 frames) #229 SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11) ... Normal element mounting (7 frames) #236 SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11) ... Normal element mounting (7 frames) #243 _NestedHookElement.mount (package:nested/nested.dart:187:11) ... Normal element mounting (7 frames) #250 SingleChildWidgetElementMixin.mount (package:nested/nested.dart:222:11) #251 Element.inflateWidget (package:flutter/src/widgets/framework.dart:3971:16) #252 Element.updateChild (package:flutter/src/widgets/framework.dart:3702:20) #253 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:5111:16) #254 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5251:11) #255 Element.rebuild (package:flutter/src/widgets/framework.dart:4805:7) #256 BuildOwner.buildScope (package:flutter/src/widgets/framework.dart:2780:19) #257 WidgetsBinding.drawFrame (package:flutter/src/widgets/binding.dart:903:21) #258 RendererBinding._handlePersistentFrameCallback (package:flutter/src/rendering/binding.dart:358:5) #259 SchedulerBinding._invokeFrameCallback (package:flutter/src/scheduler/binding.dart:1284:15) #260 SchedulerBinding.handleDrawFrame (package:flutter/src/scheduler/binding.dart:1214:9) #261 SchedulerBinding._handleDrawFrame (package:flutter/src/scheduler/binding.dart:1072:5) #262 _invoke (dart:ui/hooks.dart:142:13) #263 PlatformDispatcher._drawFrame (dart:ui/platform_dispatcher.dart:359:5) #264 _drawFrame (dart:ui/hooks.dart:112:31) ════════════════════════════════════════════════════════════════════════════════════════════════════ ``` </details> ### How to Reproduce 1. Open AppFlowy (Eg. from release, or build and run appflowy) 2. Build and run AppFlowy from Dev Environment (You can run two instances easily from dev environment as well) ### Expected Behavior App doesn't crash / no red-screen ### Operating System MacOS ### AppFlowy Version(s) `main` ### Screenshots _No response_ ### Additional Context _No response_
mirror 2026-03-23 20:51:42 +00:00
  • closed this issue
  • added the
    bug
    label
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
AppFlowy-IO/AppFlowy#1613
No description provided.