Flutter-Global-Config icon indicating copy to clipboard operation
Flutter-Global-Config copied to clipboard

Unable to use configuration value as default for a constructor parameter

Open GiteshDalal opened this issue 4 years ago • 1 comments

Because GlobalConfiguration doesn't have a const constructor. It's not possible to use a configured value as a default for a parameter in class constructors.

This is not possible right now const Duration(milliseconds: 150 * GlobalConfiguration().getValue<int>('animationMultiplier'))

GiteshDalal avatar Jan 05 '21 04:01 GiteshDalal

I am not sure if this makes sense at all due to the fact that values from the config can change over time. I for example use this package in combination with shared preferences to hold the shared pref data in memory and make it globaly available. When i update the shared pref data i also have to update the data stored in the global configuration singleton.

But I am open minded for a PR. Feel free to contribute this.

Ephenodrom avatar Mar 05 '21 09:03 Ephenodrom