call method

  1. @override
Future call(
  1. ResultModel either,
  2. Sink<BaseBlocPrimaryState>? sinkState, {
  3. Function? execute,
  4. Function? onError,
})
override

Implementation

@override
Future<dynamic> call(final either, Sink<BaseBlocPrimaryState>? sinkState,
    {Function? execute, Function? onError}) async {
  if (either is Error) {
    LoggerDefault.log.e(either.message);
    sinkState!.add(ErrorState(error: either));
    if (onError != null) onError();
  } else if (execute != null) {
    return await execute();
  }
}