Skip to content

dart-ecosystem/type_resolver.dart

Repository files navigation

TypeResolver

TypeResolver provides Type and String with the ability to ultimately resolve to an instance or Type.

Usage

Annotate class that need to resolve with @TypeResolvable

@TypeResolvable()
class Animal {}

Remember to initialize at main function

void main() {
  initializeTypeResolver();
}

Resolve String to Type

void fn() {
  TypeResolver.parseTypeFromTypeString("Animal");
}

Resolve Type to instance

void fn() {
  TypeResolver.createInstanceFromType(Animal);
}

Resolve String to instance

void fn() {
  TypeResolver.createInstanceFromTypeString("Animal");
}

About

TypeResolver provides Type and String with the ability to ultimately resolve to an instance or Type.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages