Getx: In Get.arguments change object to dynamic

Created on 1 Aug 2020  路  3Comments  路  Source: jonataslaw/getx

Fill in the template. Issues that do not respect the model will be closed.

Describe the bug
When i input map to Get.toNamed arguments, thats not working to call that map.

print(Get.arguments['mapKey']);

Will throw error like this

The operator '[]' isn't defined for the type 'Object'. Try defining the operator '[]'.

Expected behavior
Working like if in type of dynamic. If i convert to dynamic, working as i expected.

dynamic arguments = Get.arguments;
print(arguments['mapKey']); // This working

Flutter Version:
1.17.4

Get Version:
3.4.1

My english is very bad, i'm sorry.

enhancement

Most helpful comment

You need to declare type first before get the map

Map<String, dynamic> arguments = Get.arguments;

print(arguments['key']);

All 3 comments

You need to declare type first before get the map

Map<String, dynamic> arguments = Get.arguments;

print(arguments['key']);

Yes, but what i want is like this

print(Get.arguments['key']);

That possible if Get.arguments type changed from Object to dynamic

PR pushed and waiting for approval,
I doubt it will bring any breaking changes.

Was this page helpful?
0 / 5 - 0 ratings