Last updated:
0 purchases
resource provider
Resource Provider #
A simple resource provider to get objects by type (or by both name and type). Right now it eagerly creates an object on get.
Features #
Resource providers maintains collection of resources in its instance and all of them can be disposed after usage.
Getting started #
Add dependency with dart pub add resource_provider or flutter pub add resource_provider.
Import the package
import 'package:resource_provider/resource_provider.dart';
copied to clipboard
Create an instance of ResourceProvider.
final resource = ResourceProvider();
copied to clipboard
Get a resource (Will always return same instance).
resource(ResourceData(onCreate: someValueCallback))}
copied to clipboard
You can update the returning resource's value by providing a value.
resource(ResourceData(onCreate: someValueCallback), value: someUpdatedValue)}
copied to clipboard
clear resources after usage to dispose.
resource.clear(); // or resource.dispose();
copied to clipboard
For personal and professional use. You cannot resell or redistribute these repositories in their original state.
There are no reviews.