0

Flutter hot reload and hot restart stop working after doing the minimum to connect my app to a firebase project.

I have connected three different flutter projects to three different firebase projects and none of them have allowed me to hot reload or hot refresh. After following the instructions on firebase to connect my app the only thing I add is this.

main() async {
  WidgetsFlutterBinding.ensureInitialized();
  await Firebase.initializeApp();
  runApp(MyApp());
}

and I always get the same errors:

Unhandled exception:
Null check operator used on a null value
#0      IncrementalCompiler._initializeExperimentalInvalidation (package:front_end/src/fasta/incremental_compiler.dart:1226:53)
<asynchronous suspension>
#1      IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:324:11)

<asynchronous suspension>
#2      IncrementalCompiler.compile (package:vm/incremental_compiler.dart:68:50)
<asynchronous suspension>
#3      FrontendCompiler.compile (package:frontend_server/frontend_server.dart:572:11)
<asynchronous suspension>
#4      listenAndCompile.<anonymous closure> (package:frontend_server/frontend_server.dart:1210:11)
<asynchronous suspension>
chris
  • 3
  • 1

1 Answers1

0

This is not Flutter's Hot reload and hot restart issue. This may occur due to the following:

  • Installed packages (pub).
  • Nullability

You should check the compatibility of some of your packages with the firebase package. Your log shows frontend_server.dart and incremental_compiler.dart contain null checks on null values.

If you are the creator of those files, you need to update the codebase by handling null this way:

if (value != null) {
    // do something
}

Else

flutter pub clean cache
flutter pub get
flutter build
  • I am not the creator of those files nor can I find them in my flutter project, do you think it could be due to installing incompatible packages because the only ones I installed are firebase core 2.4.0 and firebase auth 4.2.3 – chris Dec 29 '22 at 00:25
  • If you are not the creator then I have to resolve to "installing incompatible packages" as you suggested. Find out the compatible versions and use them. The disadvantage of packages :( – Ibukunoluwa Naphtali Dec 29 '22 at 09:32