有什么方法可以避免在多次使用 Dart 时显式指定类名?
假设我有类似的东西
class VehicleType{
static const int BICYCLE = 0;
static const int CAR = 1;
static const int BUS = 2;
// ... etc ...
}
class VehicleGroup{
static List<int> YEARLY_INSPECTION =[
VehicleType.CAR,
VehicleType.BUS
];
static List<int> REQUIRES_LICENSE =[
VehicleType.CAR,
VehicleType.BUS
];
static List<int> NO_MINIMUM_AGE =[
VehicleType.BICYCLE
];
// ... etc ...
}
有什么方法可以避免必须为VehicleType.
组中的每个成员明确指定?我正在考虑with
类似于 Javascript、Visual Basic 和 Object Pascal 等其他语言中可用的语句。