Dart Redstone: How to use interceptors declared in different packages?

64 Views Asked by At

Interceptors work when I declare them in same package, but when I declare them in different package, they are not being registered and never being called.

How can I use interceptors declared in different packages?

1

There are 1 best solutions below

0
On

If you are just using a single library with parts to have multiple groups, you can do it like this. You create a library (in /lib) containing all the groups. For example: library rest_api

Then, in the main file where you start redstone:

app.redstoneSetUp([#rest_api]);

Make sure you import the library first. The analyzer will most likely give you a warning for unused import, but you can ignore it by adding

// ignore: unused_import

before the line or at the end of the line that produces the warning.