Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

The argument type 'List<dynamic>' can't be assigned to the parameter type 'Iterable<Object>'

I have upgraded my Flutter project version to the current latest flutter version (2.5.3) after upgraded occurs this error.

Code as follows,

final List<Object> _prop = [];

@override
  List<Object> get prop => _prop;

  EnvironmentState([List prop = const []]) {
    this._prop.addAll(prop);         //        <------ Here is the error occurs
  }

Error as follows,

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

The argument type 'List<dynamic>' can't be assigned to the parameter type 'Iterable<Object>

>Solution :

Error message tells us, List<dynamic> can’t be assigned to List<Object>. In this case you provide parameter, default List is dynamic.

final List<Object> _prop = [];

  @override
  List<Object> get prop => _prop;

  EnvironmentState([List<Object> prop = const []]) {
    this._prop.addAll(prop);  
  }

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading