diverpro 1.0.4 copy "diverpro: ^1.0.4" to clipboard
diverpro: ^1.0.4 copied to clipboard

DiverPro is a State Management Library and Dependency Injection package for Flutter. It's my take on Riverpod and Provider.

DiverPro #

DiverPro is a State Management Library and Dependency Injection package for Flutter. It's my take on Riverpod and Provider.

Features #

  • State management
  • Dependency injection
  • Singleton, factory, and lazy singleton support

Getting started #

To use this package, add diverpro as a dependency in your pubspec.yaml file.

dependencies:
  diverpro:
    git:
      url: https://github.com/unix14/diverpro.git
      ref: main
copied to clipboard

Usage #

Registering Instances #

You can register instances, factories, singletons, and lazy singletons using the DiverPro class.

import 'package:diverpro/diverpro.dart';

void main() {
    final diverPro = DiverPro();

    // Register an instance
    diverPro.register<MyClass>(MyClass());
    
    // Register a factory
    diverPro.factory<MyClass>(() => MyClass());
    
    // Register a singleton
    diverPro.singleton<MyClass>(() => MyClass());
    
    // Register a lazy singleton
    diverPro.lazySingleton<MyClass>(() => MyClass());
}
copied to clipboard

Retrieving Instances #

You can retrieve instances using the get method.

final myClassInstance = diverPro.get<MyClass>();
copied to clipboard

Clearing Instances #

You can clear all registered instances using the clear method.

DiverPro.clear();
copied to clipboard

Additional information #

Contributions are welcome! Please file issues and submit pull requests on the GitHub repository.

1
likes
150
points
54
downloads

Publisher

verified publisher3p-cups.com

Weekly Downloads

2024.09.14 - 2025.03.29

DiverPro is a State Management Library and Dependency Injection package for Flutter. It's my take on Riverpod and Provider.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, livedatax

More

Packages that depend on diverpro