[PAGE ISSUE]: 'Pass arguments to a named route'
Page URL
https://docs.flutter.dev/cookbook/navigation/navigate-with-arguments/
Page source
https://github.com/flutter/website/tree/main/src/cookbook/navigation/navigate-with-arguments.md
Describe the problem
The document show example may be not null safety
Expected fix
Add null safety check passing arguments.
Additional context
No response
Hi @cnmade, what part of the cookbook do you think is not null safe?
For a real-world app powered by flutter, we may have two scenarios
- may pass arguments
- may not pass arguments or pass null
My real-world code looks like
In scenario 1, we pass arguments, then we can get args, which have values.
In scenario 2, we have null, args == null, and we use the default value to display the variable.
I thought the document should cover more real world. May the passing argument be null ? how can we handle with Null ? Document should provided good example to show the power.
I think I get your point, but for the record, the example is null-safe.
Improving the example to show how to handle/deal with missing/null parameters may be good overall for beginners.
The document told us:
1 + 1 = 2
The real world case:

me be like:

These examples are null safe. Closing this issue.