Is it possible to pass some argument to a dart application when running it using pub serve
? What I'm trying to do is have an application use some mocked services while I'm developing it, but then when it's deployed I'd like to replace mocked services with real ones. For example:
const bool DEBUG = true;
class AppModule extends Module {
AppModule() {
type(PaymentService, implementedBy: DEBUG ? PaypalPaymentService : MockPaymentService );
}
}
I'd like this DEBUG parameter to somehow come form the environment and to be easily configurable when running the application using pub serve
. Which is the best way to achieve this?