Seamlessly Manage Persistent Data in Your Flutter Apps

Flutter Data

Flutter Data is the seamless way to work with persistent data models in Flutter.

Inspired by Ember Data and ActiveRecord.

⚠️ DOCUMENTATION IS OUT OF DATE. I’m working on it, please bare with me!

Refer to and


  • Auto-generated repositories (REST clients) for all models πŸš€
    • CRUD and custom actions on remote API
    • StateNotifier, Future and Stream APIs
  • Built for offline-first πŸ”Œ
    • uses Hive at its core for caching & local storage
    • included read/write retry offline adapter
  • Effortless setup ⏰
    • Automatically pre-configured for provider, riverpod and get_it
    • Convention over configuration powered by Dart mixins
  • Exceptional relationship support ⚑️
    • Automatically synchronized, traversable relationship graph
    • Reactive relationships
  • Clean, intuitive API and minimal boilerplate πŸ’™
    • Truly configurable and composable
    • Scales very well (both up and down)
Check out the Documentation or the Tutorial πŸ“š where we build a CRUD app from the ground app in record time.

Getting started

See the quickstart guide in the docs.

πŸ‘©πŸΎβ€πŸ’» Usage

For a given User model annotated with @DataRepository…

class User with DataModel<User> {
  final int id;
  final String name;

mixin MyJSONServerAdapter on RemoteAdapter<User> {
  String get baseUrl => "";
  • id can be of int, String, etc
  • User.fromJson and toJson are not required!

After a code-gen build, Flutter Data will generate a Repository<User>:

// obtain it via Provider
final repository =<Repository<User>>();

return DataStateBuilder<List<User>>(
  notifier: () => repository.watchAll();
  builder: (context, state, notifier, _) {
    if (state.isLoading) {
      return CircularProgressIndicator();
    // state.model is a list of 10 user items
    return ListView.builder(
      itemBuilder: (context, i) {
        return UserTile(state.model[i]);

repository.watchAll() will make an HTTP request (to in this case), parse the incoming JSON and listen for any further changes to the User collection – whether those are local or remote!

state is of type DataState which has loading/error/data substates. Moreover, notifier.reload() is available, useful for the classic β€œpull-to-refresh” scenario.

In addition to the reactivity, a User now gets extensions and automatic relationships, ActiveRecord-style:

final todo = await Todo(title: 'Finish docs').init(context).save();
print(; // 201

final user = await repository.findOne(1, params: { '_embed': 'todos' });
// GET
print(user.todos.length); // 20

await user.todos.last.delete();

For an in-depth example check out the Tutorial.

Fully functional app built with Flutter Data? See the code for the finished Flutter Data TO-DOs Sample App.


Fully compatible with the tools we know and love:

Flutter βœ… It can also be used with pure Dart
json_serializable βœ… Not required! Other fromJson/toJson can be supplied
JSON REST API βœ… Great support
JSON:API βœ… Great support
Firebase βœ… Adapter coming soon πŸŽ‰ as well as Firebase Auth
Provider βœ… Not required! Configure in a few lines of code
Riverpod βœ… Not required! Configure in a few lines of code
get_it βœ… Not required! Configure in a few lines of code
BLoC βœ… Great support
Freezed βœ… Good support
Flutter Web βœ… Great support
Hive βœ… Flutter Data uses Hive internally for local storage
Chopper/Retrofit Not required: Flutter Data generates its own REST clients

πŸ“² Apps using Flutter Data

The new offline-first Scout Flutter app is being developed in record time with Flutter Data.

βž• Questions and collaborating

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

You can also hit me up on Twitter @thefrank06

Tests can be run with: pub run test

Download Details:

Author: flutterdata

Source Code:

#flutter #dart #mobile-apps

Seamlessly Manage Persistent Data in Your Flutter Apps
13.10 GEEK