Flutter / Dart Error: The argument type 'Null Function(Key)' can't be assigned to the parameter type 'void Function(Object)'

4,215

Answered by Simon Binder via dart-lang/TALK-general:

This is an error in the reorderables package, which you probably depend on. A report and workaround is here: hanshengchiu/reorderables#52

Change in pubspec.yaml:

#  reorderables: ^0.2.12
  reorderables:
    git:
      url: git://github.com/hanshengchiu/reorderables.git
Share:
4,215
Yatko
Author by

Yatko

Design is how it works -Steve Jobs

Updated on December 17, 2022

Comments

  • Yatko
    Yatko over 1 year

    Android Studio: Launching lib/main.dart on iPhone 11 Pro Max in debug mode...

    Compiler message:
    /Users/[User]/.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_flex.dart:727:18: Error: The argument type 'Null Function(Key)' can't be assigned to the parameter type 'void Function(Object)'.
     - 'Key' is from 'package:flutter/src/foundation/key.dart' ('/Users/[User]/Development/flutter/packages/flutter/lib/src/foundation/key.dart').
     - 'Object' is from 'dart:core'.
            onLeave: (Key leaving) {},
                     ^
    /Users/[User]/.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_wrap.dart:951:18: Error: The argument type 'Null Function(int)' can't be assigned to the parameter type 'void Function(Object)'.
     - 'Object' is from 'dart:core'.
            onLeave: (int leaving) {},
                     ^
    /Users/[User]/.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_wrap.dart:957:18: Error: The argument type 'Null Function(int)' can't be assigned to the parameter type 'void Function(Object)'.
     - 'Object' is from 'dart:core'.
            onLeave: (int leaving) {},
                     ^
    /Users/[User]/.pub-cache/hosted/pub.dartlang.org/reorderables-0.2.12/lib/src/widgets/reorderable_sliver.dart:842:18: Error: The argument type 'Null Function(int)' can't be assigned to the parameter type 'void Function(Object)'.
     - 'Object' is from 'dart:core'.
            onLeave: (int leaving) {},
                     ^
    Target kernel_snapshot failed: Exception: Errors during snapshot creation: null
    Failed to build bundle.
    Error launching application on iPhone 11 Pro Max.
    

    Can't get an answer to pass trough this issue, any help will be greatly appreciated ☃