loadFromAssets method

Future<FormStack> loadFromAssets(
  1. List<String> files, {
  2. MapKey? mapKey,
  3. LocationWrapper? initialLocation,
})

Import and parse multiple JSON files located in the assets folder.

Implementation

Future<FormStack> loadFromAssets(List<String> files,
    {MapKey? mapKey, LocationWrapper? initialLocation}) async {
  for (var element in files) {
    String data = await rootBundle.loadString(element);
    ParserUtils.buildFormFromJson(
        this,
        json.decode(data),
        mapKey ?? MapKey("", "", ""),
        initialLocation ?? LocationWrapper(0, 0));
  }
  return this;
}