Last updated:
0 purchases
ioc annotation
IoC Annotation #
Quickly generate IoC singleton objects through annotations.
Installation #
# pubspec.yaml
dependencies:
ioc_annotation: ^1.0.0
dev_dependencies:
build_runner:
copied to clipboard
Usage #
Use @IoC to mark classes that need to be instantiated.
// person.dart
abstract class Person {
hello();
}
// Student.dart
import 'package:ioc_annotation/ioc_annotation.dart';
import 'package:test_demo/person.dart';
@IoC()
class Student implements Person {
@override
hello() {
print('hello');
}
}
copied to clipboard
Use @IoCInstance to mark the single instance that needs to be generated.
// services.dart
import 'package:ioc_annotation/ioc_annotation.dart';
@IoCInstance()
abstract class Services {}
copied to clipboard
Execute this command.
flutter pub run build_runner build
copied to clipboard
Automatically generated IoC instances.
// services.ioc.dart
class Services {
/// ....
}
copied to clipboard
LICENSE #
MIT
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.