zoukankan      html  css  js  c++  java
  • Flutter

    Compiler message:
    lib/main.dart:77:32: Error: 'Toast' is imported from both
    'package:easy_alert/src/provider.dart' and 
    'package:fluttertoast/fluttertoast.dart'.
    toastLength: Toast.LENGTH_LONG);

    由于引用的"Toast"同时存在于package  easy_alert fluttertoast中,编译器不确定到底是引用的哪一个包中的Toast,因此报错。

    解决方法:

    import 'package:easy_alert/easy_alert.dart' as easyAlertV;
    import 'package:fluttertoast/fluttertoast.dart' as flutterToastV;

    然后

    flutterToastV.Fluttertoast.showToast(msg: "数据存储成功",
                        toastLength: flutterToastV.Toast.LENGTH_SHORT,
                        gravity: flutterToastV.ToastGravity.BOTTOM,
                        timeInSecForIos: 1
                      );

    原文参考我的Stackoverflow https://stackoverflow.com/questions/53359139/error-toast-is-imported-from-both-packageeasy-alert-src-provider-dart-and

  • 相关阅读:
    9-15
    9-5
    8-26
    8-24
    7-20
    7-17
    我离职后要干些什么
    6-18
    5-28
    5-20
  • 原文地址:https://www.cnblogs.com/hupo376787/p/9982074.html
Copyright © 2011-2022 走看看