skip to Main Content

======== Exception caught by widgets library =======================================================
The following LateError was thrown building StreamBuilder<QuerySnapshot<Object?>>(dirty, dependencies: [_InheritedProviderScope<DataManagerProvider?>], state: _StreamBuilderBaseState<QuerySnapshot<Object?>, AsyncSnapshot<QuerySnapshot<Object?>>>#92f1f):
LateInitializationError: Field ‘photographerProfile’ has not been initialized.

The relevant error-causing widget was:
StreamBuilder<QuerySnapshot<Object?>> StreamBuilder:file:///C:/Users/RANGO/StudioProjects/photography/lib/screens/photographer/photographer_dashboard.dart:101:18
When the exception was thrown, this was the stack:
#0 DataManagerProvider.photographerProfile (package:photography/data%20manager/data_manager.dart)
#1 DataManagerProvider.getPhotographerProfile (package:photography/data%20manager/data_manager.dart:54:51)
#2 _PhotographerDashboardState.build.. (package:photography/screens/photographer/photographer_dashboard.dart:107:24)
#3 StreamBuilder.build (package:flutter/src/widgets/async.dart:444:81)
#4 _StreamBuilderBaseState.build (package:flutter/src/widgets/async.dart:124:48)
#5 StatefulElement.build (package:flutter/src/widgets/framework.dart:5080:27)
#6 ComponentElement.performRebuild (package:flutter/src/widgets/framework.dart:4968:15)
#7 StatefulElement.performRebuild (package:flutter/src/widgets/framework.dart:5133:11)
#8 Element.rebuild (package:flutter/src/widgets/framework.dart:4690:5)

2

Answers


  1. it would be great if you can add your code, but for what I see, you are trying to use photographerProfile without initializing it, so you would need to initialize that value before using it.

    Login or Signup to reply.
  2. There is a variable on the file: ../lib/screens/photographer/photographer_dashboard.dart

    Line 101, Column 18

    late photographerProfile...

    that is used as a late initialization but is used without being initialized first. currently, flutter has no way to check if a variable has been initialized so maybe you could make it nullable instead?

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search