The name 'LocationAccuracy' is defined in the libraries 'package:geolocation/geolocation.dart', 'package:geolocator/geolocator.dart' and 'package:location_platform_interface/location_platform_interface.dart (via package:location/location.dart)'.
Try using 'as prefix' for one of the import directives, or hiding the name from all but one of the imports.dartambiguous_import
2条答案
按热度按时间o4hqfura1#
此消息是因为在多个库中定义了
LocationAccuracy
。因此,您需要定义从哪个库获取此LocationAccuracy。因此,您需要在导入后指定一个前缀,如下所示:然后,您可以通过以下方式引用要使用的特定
LocationAccuracy
:geo.LocationAccuracy
或geolocator.LocationAccuracy
jgovgodb2#
您还可以使用第二个隐藏LocationAccuracy的建议,在导入'package:geolocator/geolocator.dart'后添加此内容,如下所示: