17

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!
SardorbekR
  • 1,388
  • 3
  • 18
  • 33
  • I used @răzvan-puiu 's answer. ``` void main() { WidgetsFlutterBinding.ensureInitialized(); runApp(const MyApp()); } ``` It worked. – Maharun Afroz Jun 22 '23 at 12:55

4 Answers4

8

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.

Răzvan Puiu
  • 671
  • 1
  • 6
  • 24
6

Literally

File -> Invalidate Caches -> Clear Filesystem Cache

And then rebuilding fixed it for me (React Native 0.68.2)

Karatekid430
  • 940
  • 11
  • 25
0

I have super.build(); in my widget for no reason. Just forgot to delete the code. So I removed the code and fixed.

class _VehicleAddState extends State<VehicleAdd>
    with AutomaticKeepAliveClientMixin<VehicleAdd> {
  double selectedMenu = 0;
  @override
  Widget build(BuildContext context) {
    super.build(context);
  • As it’s currently written, your answer is unclear. Please [edit] to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 08 '23 at 02:00
0

The message actually doesn't affect the functionality of the app. But still you can add a line in the main(). Add WidgetsFlutterBinding.ensureInitialized(); in the main function

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MyApp());
}
toyota Supra
  • 3,181
  • 4
  • 15
  • 19
Karun Jose
  • 41
  • 3