Is it possible to some how achieve something like that?
class SomeClass<T> {
}
And then use or feed it as following?
Type someType = MyType;
SomeClass c = SomeClass<someType>();
CodePudding user response:
You can do something like that :
class SomeClass<T> {
}
typedef DataList = List<int>;
SomeClass c = SomeClass<DataList>();
Note that before Dart 2.13, aliases (typedef) were allowed for functions only. Static analysis will ask you to to set the minimum SDK constraint to 2.14.0 or higher before allowing you to compile. You can do that in you pubspec.yaml