setConfig static method

Future<FileConfig> setConfig(
  1. FileConfig fileConfig
)

Install fileConfig as the active translation config.

If fileConfig has a non-null ConfigFileRef with a read callback, the file is read first and any ConfigParseException propagates to the caller. Refless configs (those used purely for their mapper hook) are installed immediately.

Concurrent calls are serialised: the last call to enter the chain becomes the active config when its read completes.

Implementation

static Future<FileConfig> setConfig(FileConfig fileConfig) {
  final completer = Completer<FileConfig>();
  _writeChain = _writeChain.then(
    (_) => _runOne(fileConfig, completer),
    onError: (Object _) => _runOne(fileConfig, completer),
  );
  return completer.future;
}