standard_repositories 0.0.1-dev.2 copy "standard_repositories: ^0.0.1-dev.2" to clipboard
standard_repositories: ^0.0.1-dev.2 copied to clipboard

A new standard for repositories in your Flutter applications.

Standard Repositories #

secret_manager coverage pub package style: very good analysis License: MIT

Provides an interface for Repositories in your Flutter apps.

If you've never heard of the concept of repositories, you can read about theme in the bloc documentation.

Usage #

Create a repository for a particular type

class StringRepository extends Repository<String> {
    StringRepository(super.initialValue);

    void makeUpperCase() {
        value = value.toUpperCase();
    }
}

Use the repository in your app

final repository = StringRepository('Hello, world!');
final subscription = repository.stream.listen((value) {
    print(value);
});

repository.makeUpperCase();

subscription.cancel();

Prints

  • Hello, world!
  • HELLO, WORLD!

Available Repositories #

Repository #

A simple repository that allows you to manage a single value.

Setting Values:

  • value = value: Set the value to a new value.

Reading Values:

  • stream: A stream of the value.
  • value: The current value.

MultiRepository #

A repository that allows you to manage a collection of values.

Setting Values:

  • value = values: Set the collection to a new value.
  • add(value): Add a value to the collection.
  • addAll(values): Add multiple values to the collection.

Reading Values:

  • stream: A stream of the collection.
  • value: The current value of the collection.
  • streamWhere(test): A stream of the values that match the test.
  • singleWhere(test): The first value that matches the test.
  • streamSingleWhere(test): A stream of the first value that matches the test.
0
likes
150
points
146
downloads

Publisher

unverified uploader

Weekly Downloads

A new standard for repositories in your Flutter applications.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

collection, hive_ce, meta, rxdart

More

Packages that depend on standard_repositories