Skip to content

Return type in the TypedMiddleware is void #65

@loposkin

Description

@loposkin

The middleware has the return type void in the TypedMiddleware class

class TypedMiddleware<State, Action> implements MiddlewareClass<State> {
/// A [Middleware] function that only works on actions of a specific type.
final void Function(
Store<State> store,
Action action,
NextDispatcher next,
) middleware;
/// Create a [Middleware] that is only executed when the dispatched action
/// matches the [Action] type.
TypedMiddleware(this.middleware);
@override
dynamic call(Store<State> store, dynamic action, NextDispatcher next) {
if (action is Action) {
return middleware(store, action, next);
} else {
return next(action);
}
}
}

I've expected that after merging #52 middleware should have the return type dynamic, but this line was not changed. Is it a bug or is there a reason for this behavior?
Possible pull request: #66

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions