Dart如何明确说明要使用哪个包类?

Dart如何明确说明要使用哪个包类?,dart,geolocation,location,flutter,flutter-dependencies,Dart,Geolocation,Location,Flutter,Flutter Dependencies,我有一个Dart(颤振)应用程序,它同时使用和包。我的问题是这两者都定义了一个“Location”类 如何明确说明在任何特定调用中使用的两个类中的哪一个 e、 g.我尝试用包名作为类名的前缀: location.Location = new Location(); map_view.Location = new Location(45.5231233, -122.6733130); 但是Dart似乎不喜欢这种语法。找到了答案。您必须按照以下要求为库指定前缀: 之后,可以使用类名中的前缀使其正

我有一个Dart(颤振)应用程序,它同时使用和包。我的问题是这两者都定义了一个“Location”类

如何明确说明在任何特定调用中使用的两个类中的哪一个

e、 g.我尝试用包名作为类名的前缀:

location.Location = new Location();

map_view.Location = new Location(45.5231233, -122.6733130);

但是Dart似乎不喜欢这种语法。

找到了答案。您必须按照以下要求为库指定前缀:

之后,可以使用类名中的前缀使其正常工作:

import 'package:location/location.dart' as locLib;
import 'package:map_view/map_view.dart' as mapViewLib;

locLib.Location = new Location();
mapViewLib.Location = new Location(45.5231233, -122.6733130);

我认为应该是locLib.Location=new locLib.Location();