A value of type 'Object?' can't be assigned to a variable of type 'Map<dynamic, dynamic>'. Its a Routing error

Solution 1:

After passing so many problems, finally, the solution is surprisingly easy.

Map data = {};
data = ModalRoute.of(context).settings.arguments as Map; 

Solution 2:

Try using:

data=ModalRoute.of(context)?.settings?.arguments as Map;

The ? is used for null safety