repository_flutter 0.1.0+1 copy "repository_flutter: ^0.1.0+1" to clipboard
repository_flutter: ^0.1.0+1 copied to clipboard

A package aimed at providing seamless integration between the repository library and Flutter, creating a communication widget between them.

Flutter Repository #

style: very good analysis Powered by Mason License: MIT

A package aimed at providing seamless integration between the Repository library and Flutter, creating a communication widget between them.

Installation 💻 #

❗ In order to start using Repository Builder you must have the Flutter SDK installed on your machine.

Add repository_flutter to your pubspec.yaml:

dependencies:
  repository_flutter:

Install it:

flutter packages get

Usage #

Lets take a look at how to use RepositoryBuilder to provide a react to state changes in a Repository.

currencies_repository.dart #

class CurrenciesRepository extends CustomHttpRepository<Currencies> {
  @override
  Iterable<Currency> fromJson(json) {
    return RemoteCurrenciesModel.from(
      raw: jsonDecode(json),
    );
  }

  @override
  Uri get endpoint => "https://localhost:8080/api/v1/currency/supported";
}

currencies_page.dart #

class CurrenciesPage extends StatelessWidget {
  const CurrenciesPage();

  final _repository = CurrenciesRepository();

  Widget build(BuildContext context) {
    return Scaffold(
      body: RepositoryBuilder(
        repository: _repository,
        builder: (context, currencies) {
          if (currencies == null) {
            return const Center(
              child: SizedBox(
                child: CircularProgressIndicator(),
              ),
            );
          } else {
            return ListView(
              children: [
                for (currency in currencies)
                  CurrencyListTile(currency: currency)
              ]
            );
          }
        }
      ),
    );
  }
}
0
likes
150
points
0
downloads

Publisher

unverified uploader

Weekly Downloads

A package aimed at providing seamless integration between the repository library and Flutter, creating a communication widget between them.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter, repository

More

Packages that depend on repository_flutter