flutter_typeahead icon indicating copy to clipboard operation
flutter_typeahead copied to clipboard

Null Safety Error

Open nathanielajayi7 opened this issue 2 years ago • 2 comments

Apparently, this package isn't fully null safety compliant

/C:/flutter/.pub-cache/hosted/pub.dartlang.org/flutter_typeahead-4.0.0/lib/src/flutter_typeahead.dart:803:29: Error: Method 'addPostFrameCallback' cannot be called on 'WidgetsBinding?' because it is potentially null.

  • 'WidgetsBinding' is from 'package:flutter/src/widgets/binding.dart' ('/C:/flutter/packages/flutter/lib/src/widgets/binding.dart'). package:flutter/…/widgets/binding.dart:1 Try calling using ?. instead. WidgetsBinding.instance.addPostFrameCallback((duration) {

nathanielajayi7 avatar Jun 02 '22 08:06 nathanielajayi7

Use the previous version3.2.7. It worked for me.

Tecmesh avatar Jul 06 '22 19:07 Tecmesh

Yes the major version change is for the new flutter and the older version is for the old flutter -- and type safety .. The WAY WAY older version is for non-type safety and will not longer be maintained ..

So make your app null-safe and Flutter 3 compatible and use Typeahead V4 .. that's the only version going forward that will be maintained ..

sjmcdowall avatar Jul 06 '22 21:07 sjmcdowall