'Unhandled Exception: Invalid argument (computation): The type parameter is not nullable: null

Trying to run the following Flutter code in android Studio

enter image description here

Link to code on github https://github.com/cyeh1234/bloc_bug.git

Got the following error:

enter image description here

https://www.mitrais.com/news-updates/getting-started-with-flutter-bloc-pattern/

Correct output

enter image description here



Solution 1:[1]

Remove <int> will fix this issue.

await Future.delayed(Duration(seconds: 3));

Solution 2:[2]

If you need to specify type annotations use:

await Future<dynamic>.delayed(Duration(seconds: 3));

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 John Joe
Solution 2 Zoran Juric