–preview-dart-2 type error

follow up to #32195

NextActionHandler loggingMiddleware<
            State extends Built<State, StateBuilder>,
            StateBuilder extends Builder<State, StateBuilder>,
            Actions extends ReduxActions>(
        MiddlewareApi<State, StateBuilder, Actions> api) =>
    (next) => (a) {
          new Logger('rx.logging_middleware ${a.name}')
            ..fine('')
            ..finer(a.payload is SecuritySensitive
                ? ' == security sensitive information omitted == '
                // `.toString()` is required for Thunk where payload is a function
                : (a.payload as Object).toString());
          next(a);
        };

is passed to https://github.com/davidmarne/built_redux/blob/master/lib/src/store.dart#L29

using

class RxStore extends Store<RxApp, RxAppBuilder, RxAppActions> {
  RxStore(
      {Reducer reducer,
      RxApp defaultState,
      RxAppActions actions,
      Iterable<Middleware<RxApp, RxAppBuilder, RxAppActions>> middleware})
      : super((reducer ?? RxApp.reducer().build()) as Reducer,
            defaultState ?? new RxApp(), actions ?? new RxAppActions(),
            middleware:
                middleware ?? [loggingMiddleware]);
}

at https://github.com/davidmarne/built_redux/blob/master/lib/src/store.dart#L54

Iterable<NextActionHandler> chain = middleware.map((m) => m(api));

and then chain.toList() causes

type '(MiddlewareApi<RxApp, RxAppBuilder, RxAppActions>) => ((Action) => void) => (Action) => void' is not a subtype of type '(MiddlewareApi) => ((Action) => void) => (Action) => void' of 'm'

I haven’t found anything where MiddlewareApi was used without type parameters.

Author: Fantashit

1 thought on “–preview-dart-2 type error

  1. Thanks a lot @zoechi for you help. Eventually I managed to repro it locally, issue is in the VM’s Kernel to IL translation layer. Fix is in the CQ.

Comments are closed.