load static method

void load({
  1. String? path,
  2. bool recursive = false,
})

Load configuration.

Implementation

static void load({String? path, bool recursive = false}) {
  assert(_instance == null);

  if (path != null) {
    _tryLoadConfigFile(path);
  } else {
    final dirs = recursive
        ? Spec.getPubspecsSync().map((e) => p.dirname(e.path))
        : const ['./'];

    for (final dir in dirs) {
      if (_tryLoadConfigFile(p.join(dir, _defaultConfigFile)) ||
          _tryLoadConfigFile(p.join(dir, _mainConfigFile), _configSection)) {
        return;
      }
    }

    throw Exception(
        'Config file or section alex in pubspec.yaml are not found');
  }
}