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

4 Answers 4

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.

8
  • 1
    I'm still getting this issue
    – SardorbekR
    Aug 28, 2022 at 16:14
  • 2
    MaterialApp doesn't have initialBinding parameter Nov 29, 2022 at 9:23
  • 1
    Solved. void main() { WidgetsFlutterBinding.ensureInitialized(); runApp(const MyApp()); } Jun 22 at 12:49
  • 1
    It's working for me. I just move that statement to first line in main() function.
    – Doan Thai
    Jun 29 at 9:49
  • 1
    since this answer is working for most people I'll accept it
    – SardorbekR
    Aug 29 at 5:01
6

Literally

File -> Invalidate Caches -> Clear Filesystem Cache

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

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);
1
  • 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.
    – Community Bot
    Jan 8 at 2: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());
}

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.