Flutter constructor error

2019-06-20 08:56发布

问题:

I have a problem with a code snippet I tried to play with, and since I am new to dart I don't really understand the error message. Can somebody explain to me why the error message says

The constructor returns type 'dynamic' that isn't of expected type 'widget'.

and how to fix it?

回答1:

The class MaterialList doesn't exist. It looks like maybe you meant TwoLevelList, which is deprecated. You should try ListView instead.



回答2:

If you have other import statements try to use alias as some libraries may be the reason for conflict.

Example: import 'package:html/parser.dart' as parser;



标签: dart flutter