init static method

Future<void> init({
  1. String? name,
  2. ConfigsDelegate? delegate,
  3. Set<String>? paths,
  4. Set<String>? symmetricPaths,
  5. bool connected = false,
  6. bool lazy = false,
  7. bool logThrowEnabled = kDebugMode,
  8. bool listening = true,
  9. bool showLogs = true,
  10. VoidCallback? onReady,
  11. String defaultPath = kDefaultConfigPath,
  12. PlatformType platform = PlatformType.system,
  13. EnvironmentType environment = EnvironmentType.system,
})

Initializes the configuration system.

Example:

await Configs.init(
  environment: EnvironmentType.live,
  platform: PlatformType.ios,
  onReady: () => debugPrint("Configs ready"),
);

Implementation

static Future<void> init({
  String? name,
  ConfigsDelegate? delegate,
  Set<String>? paths,
  Set<String>? symmetricPaths,
  bool connected = false,
  bool lazy = false,
  bool logThrowEnabled = kDebugMode,
  bool listening = true,
  bool showLogs = true,
  VoidCallback? onReady,
  String defaultPath = kDefaultConfigPath,
  PlatformType platform = PlatformType.system,
  EnvironmentType environment = EnvironmentType.system,
}) async {
  i._defaultPath = defaultPath;
  i._environment = environment;
  i._platform = platform;
  await i.initialize(
    name: name ?? kDefaultConfigName,
    connected: connected,
    delegate: delegate,
    paths: {defaultPath, if (paths != null) ...paths},
    symmetricPaths: {
      defaultPath,
      if (symmetricPaths != null) ...symmetricPaths,
    },
    lazy: lazy,
    logThrowEnabled: logThrowEnabled,
    listening: listening,
    showLogs: showLogs,
    onReady: onReady,
  );
}