ioc_annotation 1.0.1 copy "ioc_annotation: ^1.0.1" to clipboard
ioc_annotation: ^1.0.1 copied to clipboard

Quickly generate IoC singleton objects through annotations.

IoC Annotation #

Quickly generate IoC singleton objects through annotations.

Installation #

# pubspec.yaml
dependencies:
  ioc_annotation: ^1.0.0

dev_dependencies:
  build_runner:

Usage #

  1. 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');
  }
}
  1. 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 {}
  1. Execute this command.
flutter pub run build_runner build
  1. Automatically generated IoC instances.
// services.ioc.dart
class Services {
  /// ....
}

LICENSE #

MIT

0
likes
100
pub points
0%
popularity

Publisher

unverified uploader

Quickly generate IoC singleton objects through annotations.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (LICENSE)

Dependencies

analyzer, build, build_runner, flutter, source_gen

More

Packages that depend on ioc_annotation