redux_thunk 0.2.0

  • Installing
  • Versions
  • 89


Build Status codecov

Redux provides a simple way to update a your application's State in response to synchronous Actions. However, it lacks tools to handle asynchronous code. This is where Thunks come in.

The thunkMiddleware intercepts and calls ThunkActions, which is simply a fancy name for any function that takes 1 argument: a Redux Store. This allows you to dispatch functions (aka ThunkActions) to your Store that can perform asynchronous work, then dispatch actions using the Store after the work is complete.

The dispatched ThunkActions will be swallowed, meaning they will not go through the rest of your middleware to the Store's Reducer.


// First, create a quick reducer
final reducer = (String state, action) =>
    action is String ? action : state;

// Next, apply the `thunkMiddleware` to the Store
final store = new Store<String>(
  middleware: [thunkMiddleware],

// Create a `ThunkAction`, which is any function that accepts the 
// Store as it's only argument. Our function (aka ThunkAction) will
// simply send an action after 1 second.  This is just an example, 
// but  in real life, you could make a call to an HTTP service or 
// database instead!
final action = (Store<String> store) async {
  final searchResults = await new Future.delayed(
    new Duration(seconds: 1),
    () => "Search Results",



All the ideas in this lib are shamelessly stolen from the original redux-thunk library and simply adapted to Dart.



  • Update to work with Redux 3.0.0 & Dart 2


  • Move to github


  • Initial version, includes a thunkMiddleware, which intercepts and calls functions that are dispatched to the Store.

Use this package as a library

1. Depend on it

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

  redux_thunk: ^0.2.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter packages get

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

3. Import it

Now in your Dart code, you can use:

import 'package:redux_thunk/redux_thunk.dart';
Version Uploaded Documentation Archive
0.2.0 Mar 31, 2018 Go to the documentation of redux_thunk 0.2.0 Download redux_thunk 0.2.0 archive
0.1.1 Nov 25, 2017 Go to the documentation of redux_thunk 0.1.1 Download redux_thunk 0.1.1 archive
0.1.0 Aug 27, 2017 Go to the documentation of redux_thunk 0.1.0 Download redux_thunk 0.1.0 archive
Describes how popular the package is relative to other packages. [more]
Code health derived from static analysis. [more]
Reflects how tidy and up-to-date the package is. [more]
Weighted score of the above. [more]
Learn more about scoring.

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

  • Dart: 2.0.0
  • pana: 0.12.4


Detected platforms: Flutter, web, other

No platform restriction found in primary library package:redux_thunk/redux_thunk.dart.

Maintenance suggestions

The description is too short. (-20 points)

Add more detail about the package, what it does and what is its target use case. Try to write at least 60 characters.

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use redux_thunk.dart.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.28.0 <3.0.0
redux >=3.0.0 <4.0.0 3.0.0
Dev dependencies
test >=0.12.33 <0.13.0