Export two library which have same class name

A library name isn’t a namespace. Dart doesn’t have namespaces.
What you can do in Dart is to specify a prefix for an import.

You have to import those libraries separately if you want to use them in the same library instead of just one import with import 'C.dart;'

import 'A.dart' as a;
import 'B.dart' as b;

var m = a.MyClass();
var n = b.MyClass();

If you just want to avoid the conflict and don’t need both classes exported you can.

library chrome_app;

export 'A.dart';
export 'B.dart' hide MyClass;
// or
export 'B.dart' show MyOtherClass, AnotherOne; // define explicitly which classes to export and omit MyClass

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)