9:41 AM {location: Berlin, flag: germany.png, time: 9:41 AM} Restarted application in 4,422ms.
════════ Exception caught by widgets library ═══════════════════════════════════ The following TypeErrorImpl was thrown building Home(dirty, dependencies: [_ModalScopeStatus], state: _HomeState#b1e1d): Expected a value of type 'Map<dynamic, dynamic>', but got one of type 'Null'
The relevant error-causing widget was Home lib\main.dart:14 When the exception was thrown, this was the stack enter image description here
CodePudding user response:
declare your Map
optional Map? data = {}
CodePudding user response:
Hope Coding Well Go fine...
In Flutter if we want to pass arguments between our Widgets we Because we are on Null safty so try to pass value as it data type such as..
For example here we are taking named Route.
for 1st Screen
Map value={....};
Navigator.PushNamed('Named of page' , argument : value!=null ? value : {'Key' : 'Value is null'} );
Second Screen
final Map argument = ModalRoute.of(context)?.settings.arguments;
NOTE: Try not to bind values as dynamic bind them as there datatype hope it will solve your issue..