load static method

Loads configuration from .flxrc.json file or returns defaults.

Returns a ConfigModel loaded from the current directory's .flxrc.json file. If the file doesn't exist, returns a default configuration.

Throws FormatException if the JSON file is malformed.

Implementation

static Future<ConfigModel> load() async {
  final configFile = File('.flxrc.json');
  if (await configFile.exists()) {
    final content = await configFile.readAsString();
    final json = jsonDecode(content) as Map<String, dynamic>;
    return ConfigModel.fromJson(json);
  }

  // Return default config if file doesn't exist
  return ConfigModel(
    useFreezed: true,
    useEquatable: false,
    defaultStateManager: 'getx',
    author: 'Developer',
  );
}