Application Settings

EZ Flutter supports managing different configuration files that can be accessed inside the app.

Basics

The EzRunner loads different configuration files at startup.

Usage

EZ settings

The EzRunner loads automatically a json file with the name ez_settings.json from the assets directory. The ez_settings.json should only contain configuration that refers to the EZ Framework. EzSettingsKeys defines all settings available for the EZ Framework.

Environment settings

If envPath is set as an argument in the run method of the EzRunner, it loads the the configuration and it can be accessed via EzSettings.

EzRunner.run(CustomWidget(), envPath: "assets/env_dev.json");

Application settings

The EzRunner will load the configuration from the applicationPathand it can be accessed via EzSettings.

EzRunner.run(CustomWidget(), applicationPath: "assets/application.json");

Sharedpreferences settings

The EzRunner will automatically load configuration from the shared preferences and it can be accessed via EzSettings.

It is also possible to update the data from the shared preferences to store for example user settings.

await EzSettings.updateSp("user_fname", "Jon");

Accessing the Settings

The settings can be accessed via the EzSettings class.

Map ezSettings = EzSettings.ez();
Map envSettings = EzSettings.env();
Map appSettings = EzSettings.app();
Map spSettings = EzSettings.sp();