我有一个非常令人沮丧的问题,两个不同的包定义了相同的函数名showModalBottomSheet
我正在使用这个很棒的Flutter 翼软件. https://pub.dev/documentation/country_code_picker,它具有定义showModalBottomSheet的可传递依赖项MODEL_BOTLOW_SHEET.
在升级到最后的Flutter 版本3.7后,我无法运行我的应用程序,因为Flutter material 本身定义了另一个showModalBottomSheet函数.这会产生编译错误,因为不知道从两个不同的导入中使用哪一个.
Error (Xcode): ../../../.pub-cache/hosted/pub.dev/modal_bottom_sheet-2.1.2/lib/src/bottom_sheets/bar_bottom_sheet.dart:102:13: Error: 'ModalBottomSheetRoute' is imported from both 'package:flutter/src/material/bottom_sheet.dart' and 'package:modal_bottom_sheet/src/bottom_sheet_route.dart'.
有没有办法从所有可传递的依赖项中配置pubspec并将其告知Ingore https://pub.dev/packages/modal_bottom_sheet?
这样我就避免了这个问题,应用程序就会运行得很好.
PS:我查看了其他较新的Country Picker库,但它们不支持现有库的所有功能,所以最好也是最短的解决方案是忽略(而不是安装)上面的包