I have a Dart (Flutter) application that is making use of both the location and map_view packages. My problem is that both of these define a "Location" class.

How can I explicitly state which of the two classes I am using in any particular invocation?

e.g. I tried prefixing the class name with the package name:

location.Location = new Location();

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

But Dart doesn't seem to like this syntax.

Solution 1: srkiNZ84

Found the answer. You have to give the libraries a prefix as per: https://www.dartlang.org/guides/language/language-tour#libraries-and-visibility

after which you can use the prefix in the class name to make it work:

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);