cubepod_core 0.1.2 copy "cubepod_core: ^0.1.2" to clipboard
cubepod_core: ^0.1.2 copied to clipboard

A core component of the CubePod Application Runtime. Provides cubepod_core functionalities.

cubepod_core #

Dependency injection and the core container for CubePod. Everything else in the framework depends on this.

What's inside #

  • CubePod — the global DI container with O(1) lookups
  • Scope — singleton, factory, and scoped lifecycles
  • ResourcePool — a reusable pool of expensive objects (e.g. DB connections)
  • CubeObserver — hook into state/DI events for logging or analytics

Install #

dependencies:
  cubepod_core: ^0.1.1

Usage #

import 'package:cubepod_core/cubepod_core.dart';

// Register
CubePod.register<AuthService>(() => AuthService(), scope: Scope.singleton);
CubePod.register<UserRepo>(() => UserRepo(CubePod.get<AuthService>()));

// Resolve
final repo = CubePod.get<UserRepo>();

// Scoped lifetime (e.g. push on route open, pop on route close)
CubePod.pushScope();
CubePod.register<CartService>(() => CartService(), scope: Scope.scoped);
CubePod.popScope(); // CartService is disposed here automatically

See cubepod for the full docs.

0
likes
0
points
370
downloads

Publisher

unverified uploader

Weekly Downloads

A core component of the CubePod Application Runtime. Provides cubepod_core functionalities.

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

meta

More

Packages that depend on cubepod_core