loadDefinitions method

Future<CharacterDefinitions> loadDefinitions([
  1. String pathToAssetsDefinition = 'packages/textify/assets/matrices.json'
])

Loads character definitions from a JSON file.

pathToAssetsDefinition The path to the JSON file containing definitions.

Returns a Future

Throws an exception if loading fails.

Implementation

Future<CharacterDefinitions> loadDefinitions([
  final String pathToAssetsDefinition =
      'packages/textify/assets/matrices.json',
]) async {
  try {
    String jsonString = await rootBundle.loadString(pathToAssetsDefinition);
    fromJsonString(jsonString);
    return this;
  } catch (e) {
    throw Exception('Failed to load character definitions: $e');
  }
}