addDataOverrides method

Future<void> addDataOverrides(
  1. LanguageDataProvider dataOverrides, {
  2. bool overwrite = true,
  3. bool activate = true,
})

Add new data to the current dataOverrides.

If overwrite is true, the available translation will be overwritten.

If the activate is true, all the visible LanguageBuilders will be rebuilt automatically, notice that you may get the setState issue because of the rebuilding of the LanguageBuilder when it's still building.

Implementation

Future<void> addDataOverrides(
  LanguageDataProvider dataOverrides, {
  bool overwrite = true,
  bool activate = true,
}) async {
  final getData = await dataOverrides.getData(_currentCode!);
  _addData(data: getData, database: _dataOverrides, overwrite: overwrite);
  _codesOverrides.addAll(await dataOverrides.getSupportedCodes());
  if (activate) change(code);
  printDebug(
      'The new `dataOverrides` is added and activated with overwrite is $overwrite');
}