meta_types_redux 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • 30

meta_types_redux #

An extension of redux.dart that uses meta types to enforce type safety and implement slick reducer/middlware declarations.

0.0.1 #

  • initial annotations for annotating union, enum, and data classes


import 'package:meta_types/meta_types.dart';
import 'package:meta_types_redux/meta_types_redux.dart';

part 'example.g.dart';

abstract class $Counter {
  int get count => 0;

// $Counter tells the generator the state to use for the
// reducer and middlwarehandler code should be of type Counter
abstract class $CounterActions {
  int get increment;
  int get decrement;

void main() {
  final store = MetaTypesStore<Counter, CounterActions>(
    reducer: myReducer,
    initialState: Counter(),
    metaMiddleware: [myMiddleware],
    syncStream: true,

  store.onChange.listen((state) => print(state.count));

  // increment mw: 1
  // 1
  // increment mw: 4
  // 5
  // decrement mw: 1
  // 4

final myReducer = (Counter c, CounterActions a) => a.reduce(
      increment: _increment,
      decrement: _decrement,

Counter _increment(Counter state, int val) =>
    state.clone(count: state.count + val);

Counter _decrement(Counter state, int val) =>
    state.clone(count: state.count - val);

final myMiddleware = (
  MiddlewareApi<Counter, CounterActions> api,
  MetaNextDispatcher next,
  CounterActions a,
) =>
      increment: _incrementHandler,
      decrement: _decrementHandler,

void _incrementHandler(MiddlewareApi<Counter, CounterActions> api,
    MetaNextDispatcher next, int val) {
  print('increment mw: $val');

void _decrementHandler(MiddlewareApi<Counter, CounterActions> api,
    MetaNextDispatcher next, int val) {
  print('decrement mw: $val');

Use this package as a library

1. Depend on it

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

  meta_types_redux: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:

$ pub get

with Flutter:

$ flutter pub get

Alternatively, your editor might support pub get or 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:meta_types_redux/meta_types_redux.dart';
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 Apr 1, 2020, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.7.1
  • pana: 0.13.6

Health suggestions

Fix lib/meta_types_redux.dart. (-1.49 points)

Analysis of lib/meta_types_redux.dart reported 3 hints:

line 44 col 46: Use = to separate a named parameter from its default value.

line 45 col 35: Use = to separate a named parameter from its default value.

line 46 col 20: Use = to separate a named parameter from its default value.

Maintenance issues and suggestions

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

At the time of the analysis the homepage field was unreachable.

Support latest dependencies. (-10 points)

The version constraint in pubspec.yaml does not support the latest published versions for 1 dependency (redux).

Package is getting outdated. (-64.93 points)

The package was last published 86 weeks ago.

The package description is too short. (-20 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.


Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2-0-0-dev <3.0.0
meta ^1.0.0 1.1.8
meta_types ^0.1.0 0.1.0
redux ^3.0.0 3.0.0 4.0.0
Dev dependencies
build_runner ^0.9.0
meta_types_generator ^0.1.0