'How to create new instance with Type?
a.dart file
class A {}
b.dart file
class B {}
Another file
void createInstance(Type x){
return x(); // not working
return reflectType(x); // flutter not supported. only dart
return x.new(); // or as similar solution ??
}
Parameter x will can coming A or B or another Type.
Summary, i want to create new instance dynamically of given type (Type)
How can i solve this problem?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
