lukepighetti / fluro

Fluro is a Flutter routing library that adds flexible routing options like wildcards, named parameters and clear route definitions.
https://pub.dev/packages/fluro
MIT License
3.66k stars 416 forks source link

Update Readme for Null Safety #261

Open Alfaza0965 opened 2 years ago

Alfaza0965 commented 2 years ago

While attempting to implement using the Getting Started steps I realized that it would be great to add the newer code for the proper version of Null safety. Otherwise user will get the following error:

The argument type 'MeishiForm Function(BuildContext, Map<String, dynamic>)' can't be assigned to the parameter type 'Widget? Function(BuildContext?, Map<String, List<String>>)'.dart[argument_type_not_assignable](https://dart.dev/diagnostics/argument_type_not_assignable)

Change from:

var usersHandler = Handler(handlerFunc: (BuildContext context, Map<String, dynamic> params) { return UsersScreen(params["id"][0]); });

Change to:

var usersHandler = Handler(handlerFunc: (BuildContext? context, Map<String, dynamic> params) { return UsersScreen(params["id"][0]); });

Yeah simple fix. XD