Reading configuration files may involve two steps for your Flutter app.
Reading local files
In general, local files are in JSON or audio or video format. In this case, I talk about reading JSON files. We load language configuration files from JSON and save it in the memory.
This is called setting locale() for localization about multi language app. We load the files from JSON first time and set default locale() and fallback locale().
You should also save the locale() in SharedPreferences.
Reading from server
Reading files from server may also involve initialize data from firebase and save them. So if you have firebase data, go ahead call the await Firebase.initializeApp()
Future<void> main() async {
// setPathUrlStrategy();
WidgetsFlutterBinding.ensureInitialized();
await Firebase.initializeApp();
}
You should load your config file in general in your splash controller. As your app shows splash screen, this is the best time to load the data from the server.
You may create a seperate model for loading config files. That config model class should have fromJson() method that will return the data return by server in json format.
You may create class for model name ConfigModel. Then in splash controller you may create an instance of it like below
late ConfigModel _configModel;
ConfigModel get configModel => _configModel;
If you get server response 200, then save the data in _configModel.
Make sure that you have correct api end point points your server.