'why the flutter public repo enumn must using as words to import

I define a enum in public repo like this in flutter:

enum Result {
  ok,
  error,
}

then export the enum in root of the repo file like this:

export 'src/net/rest/result.dart';

in another repo, I want to use this enum, import the enum like this:

import 'package:wheel/src/net/rest/result.dart';

But I could not use the enum, I must change the import like this:

import 'package:wheel/src/net/rest/result.dart' as Result;

and use the enum like this Result.Result.ok, why could not use it directly? what should I do to use it directly?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source