load method
Implementation
Future<void> load() async {
// config
final mOption = MConfigOption.init(
env: option.environment,
configPath: option.configPath,
configName: option.applicationName,
);
final MConfig config = MConfig.set(
data: await rootBundle.loadString(mOption.getConfigFilePath()),
env: option.environment,
);
// environment
environmentConfig = MEnvironmentConfig.fromConfig(config: config);
// ---- plugin ----- //
// grpc
MGrpcClientConfig? grpcClientConfig;
if (option.plugin.grpcClient == true) {
grpcClientConfig = MGrpcClientConfig.fromConfig(config: config);
}
// gps
MGpsConfig? gpsConfig;
if (option.plugin.gps == true) {
gpsConfig = MGpsConfig.fromConfig(config: config);
}
// sound
MSoundConfig? soundConfig;
if (option.plugin.sound == true) {
soundConfig = MSoundConfig.fromConfig(config: config);
}
// rest
MRestConfig? restConfig;
if (option.plugin.rest == true) {
restConfig = MRestConfig.fromConfig(config: config);
}
plugin = MApplicationPluginConfig(
grpcClient: grpcClientConfig,
gps: gpsConfig,
sound: soundConfig,
rest: restConfig,
);
}