Json_serializable.dart: Add types for all generics

Created on 5 Sep 2020  路  7Comments  路  Source: google/json_serializable.dart

The analyzer shows an error without types. "implicit_dynamic_parameter"

Do you have any plans to fix it?

For example instead of this

 models: (json['models'] as List)
        ?.map((e) =>

just use this

 models: (json['models'] as List<Object>)
        ?.map((e) =>

Most helpful comment

Thank you, I read it.

But to fix the problem, not add "exclude". You might just close the generic type with an object!
json['models'] as List<Object> instead of json['models'] as List and that's all!

And in the future when nullable types will be added, just replace with json['models'] as List<Object?>?

All 7 comments

See #705

?

Thank you, I read it.

But to fix the problem, not add "exclude". You might just close the generic type with an object!
json['models'] as List<Object> instead of json['models'] as List and that's all!

And in the future when nullable types will be added, just replace with json['models'] as List<Object?>?

@kevmoo What do you think about it?

I'm not going to do anything extra here until https://github.com/dart-lang/language/issues/993#issuecomment-635618384 is resolved.

It'd just create too much churn.

I understood.

Was this page helpful?
0 / 5 - 0 ratings