when i click on a single product link it throws this error:
_CastError (type 'Null' is not a subtype of type 'String' in type cast)
and vscode sends cursor to this line:
'''final productId = ModalRoute.of(context)?.settings.arguments as String;'''
i changed ? to ! sign and that gives same error
CodePudding user response:
Your line should be:
final productId = ModalRenter code here
oute.of(context)?.settings?.arguments as String?;
CodePudding user response:
your productId returns null, please first try make to make sure that productId is not null.Don't force ! without checking for null.