modularity_core 0.1.0 copy "modularity_core: ^0.1.0" to clipboard
modularity_core: ^0.1.0 copied to clipboard

Core implementation of Modularity framework providing dependency injection container and module lifecycle management.

example/example.dart

import 'package:modularity_core/modularity_core.dart';

class AuthService {
  void login() => print('Logged in');
}

class AuthModule extends Module {
  @override
  void binds(Binder binder) {
    binder.singleton(() => AuthService());
  }
}

void main() {
  // 1. Create the binder factory (usually one per app)
  final factory = SimpleBinderFactory();

  // 2. Create the root binder
  final rootBinder = factory.create();

  // 3. Register your modules
  final authModule = AuthModule();
  authModule.binds(rootBinder);

  // 4. Use the dependencies
  final authService = rootBinder.get<AuthService>();
  authService.login();
}
1
likes
150
points
111
downloads

Publisher

unverified uploader

Weekly Downloads

Core implementation of Modularity framework providing dependency injection container and module lifecycle management.

Repository (GitHub)
View/report issues

Topics

#dependency-injection #di #modules #architecture

Documentation

API reference

License

MIT (license)

Dependencies

meta, modularity_contracts

More

Packages that depend on modularity_core