Closed hacker1024 closed 4 years ago
TypeMatchers check the exact type. They don't check inheritance. In order to check inheritance you can use FunctionMatcher. For instance,
yield TakeEvery(navigateAfterAuthStopped, pattern: (dynamic action) => action is AuthStopped);
or you can use a List to group actions without inheritance check;
yield TakeEvery(incrementAsync, pattern: [RemoteAuthStopped, StorageAuthStopped]);
I see. Thanks for the answer, and sorry for the redundant issue!
I have some abstract auth actions:
And then I have extensions for cached and remote authentication methods:
Finally, I have these sagas to handle navigation:
I would expect my
TakeEvery
statement to run on all types ofAuthStopped
, but this isn't what happens. The_typeMatcher
checks theruntimeType
property, which doesn't take inheritence into account.I propose we use
is
instead, as it seems like a better fit.