flutterdartwidgetsbinding

Expecting binder but got null


I'm getting this message on my log although everything works fine

W/Parcel: Expecting binder but got null!

Has anyone faced such issue, and how to fix it?

Steps to Reproduce:

  1. Just create a new Flutter project and run it on a simulator/emulator
  2. See logs, you'll get this message: "Expecting binder but got null"

Expected behavior:

  1. There should not be such error message

Runner Log

Launching lib/main.dart on sdk gphone64 x86 64 in debug mode...
Running Gradle task 'assembleDebug'...
✓  Built build/app/outputs/flutter-apk/app-debug.apk.
Installing build/app/outputs/flutter-apk/app-debug.apk...
Debug service listening on ws://127.0.0.1:62931/5G0AlEiF5bQ=/ws
Syncing files to device sdk gphone64 x86 64...
I/.flutter_issues(17884): Compiler allocated 4533KB to compile void android.view.ViewRootImpl.performTraversals()
E/SurfaceSyncer(17884): Failed to find sync for id=0
W/Parcel  (17884): Expecting binder but got null!

Solution

  • Try adding the line below in the main() function

    WidgetsFlutterBinding.ensureInitialized();
    

    If this doesn't work, please check that the value you pass to the initialBinding: in the MaterialApp() is not null.