flutter_data_state 0.3.1

  • Readme
  • Changelog
  • Installing
  • 75

flutter_data_state #

DataStateBuilder and other data_state Flutter utilities.

👩🏾‍💻 Usage #

@override
Widget build(BuildContext context) {
  return DataStateBuilder<String>(
    notifier: notifierCallback,
    builder: (context, state, notifier, _) {
      return RefreshIndicator(
        onRefresh: notifier.reload,
        child: ListView(
          children: [
            if (state.isLoading) CircularProgressIndicator(),
            if (state.hasException) ExceptionWidget(state.exception.toString()),
            if (state.hasModel) ModelWidget(state.model),
          ],
        ),
      );
    },
  );
}

where notifierCallback is a DataStateNotifier Function() void callback.

Examples:

  • () => repository.watchAll()
  • (() => future).asDataNotifier
  • (() => stream).asDataNotifier

Memoization #

All notifiers are passed in VoidCallbacks. They are memoized by default. If you don't want this, pass memoize: false (or control the behavior with key).

@override
Widget build(BuildContext context) {
  return DataStateBuilder<String>(
    notifier: notifierCallback
    memoize: false, // defaults to true
    key: Key(key), // optional
    builder: (context, state, notifier, _) {
      // ...
    },
  );
}

➕ Collaborating #

Please use Github to ask questions, open issues and send PRs. Thanks!

📝 License #

See LICENSE

[0.3.1] - 2020-06-17 #

  • improve memoization

[0.3.0] - 2020-06-15 #

  • update dependencies

[0.2.9] - 2020-04-21 #

  • fix builder typo
  • add docs

[0.2.8] - 2020-04-21 #

  • add lazyBuilder for built-in caching

[0.2.7] - 2020-04-19 #

  • Stupid formatting fix

[0.2.6] - 2020-04-19 #

  • Fix docs/license

[0.2.5] - 2020-04-18 #

  • DataStateBuilder initial release

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_data_state: ^0.3.1

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter pub get

Alternatively, your editor might support flutter pub get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_data_state/flutter_data_state.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
65
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
65
Overall:
Weighted score of the above. [more]
75
Learn more about scoring.

We analyzed this package on Jul 10, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.8.4
  • pana: 0.13.14
  • Flutter: 1.17.5

Analysis suggestions

Package not compatible with SDK dart

Because:

  • flutter_data_state that is a package requiring null.

Maintenance issues and suggestions

Homepage URL doesn't exist. (-20 points)

At the time of the analysis the homepage field https://github.com/flutterdata/data_state/packages/flutter_data_state was unreachable.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package.

Common filename patterns include main.dart, example.dart, and flutter_data_state.dart. Packages with multiple examples should provide example/README.md.

For more information see the pub package layout conventions.

The package description is too short. (-5 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.7.1 <3.0.0
data_state >=0.3.1 <1.0.0 0.3.3
flutter 0.0.0
flutter_state_notifier ^0.4.2 0.4.2
Transitive dependencies
async 2.4.2
collection 1.14.12 1.14.13
freezed_annotation 0.11.0
json_annotation 3.0.1
meta 1.1.8 1.2.2
nested 0.0.4
provider 4.3.1
rxdart 0.24.1
sky_engine 0.0.99
state_notifier 0.5.0
typed_data 1.1.6 1.2.0
vector_math 2.0.8 2.1.0-nullsafety
Dev dependencies
flutter_test