I'm trying to pass an argument through Navigator like this:
Navigator.of(context).pushNamed(EditProductScreen.routeName, arguments: id);
But when trying to retrieve it using final productId = ModalRoute.of(context)?.settings.arguments as String;
I'm getting this error: type 'Null' is not a subtype of type 'String' in type cast.
I've also tried using the bang ! operator but with no luck.