I am resolving lint issues, so I want help to solve this one of Avoid method calls or property accesses on a "dynamic" target.
My code is below:
class FlavorValues {
String? baseUrl;
String? name;
String? ocpApimSubscriptionKey;
FlavorValues(dynamic value) {
baseUrl = value['baseUrl']; // value throwing the lint
name = value['appName']; // value throwing the lint
ocpApimSubscriptionKey = value['ocpApimSubscriptionKey'];
}
}
the line throwing the lint is: baseUrl = value['baseUrl'];
- value is the one throwing the lint rule
CodePudding user response:
Use a Map
instead.
Like so:
FlavorValues(Map<String, dynamic> value) {
baseUrl = value['baseUrl'];
name = value['appName'];
ocpApimSubscriptionKey = value['ocpApimSubscriptionKey'];
}