报错如下:
Try correcting the name to match an existing function, or define a method or function named 'ScreenUtil'. The name 'ScreenUtil' is defined in the libraries 'package:flustars/src/screen_util.dart (via package:flustars/flustars.dart)' and 'package:flutter_screenutil/flutter_screenutil.dart'. (Documentation) Try using 'as prefix' for one of the import directives, or hiding the name from all but one of the imports.
开始没看清是哪个类库,搞的比较晕。
解决方法:
其实说的也很明白了,就是这两个库都有这个API,解决方法就是要么在其中的一个的导入加上“as前缀”:
import 'package:flutter_screenutil/flutter_screenutil.dart' as scrren;
区分两个类库的API。
要么隐藏另外一个:
import 'package:flustars/flustars.dart' hide ScreenUtil;
都可以,二选一。