addData method
Add new data to the current data
.
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> addData(
LanguageDataProvider data, {
bool overwrite = true,
bool activate = true,
}) async {
final getData = await data.getData(_currentCode!);
_addData(data: getData, database: _data, overwrite: overwrite);
_codes.addAll(await data.getSupportedCodes());
if (activate) change(code);
printDebug(
'The new `data` is added and activated with overwrite is $overwrite');
}