readFile method

Future<String> readFile(
  1. String fileName
)

Reads a file from assets folder.

Implementation

Future<String> readFile(String fileName) async {
  if (!_files.containsKey(fileName)) {
    _files[fileName] = await _readFile(fileName);
  }
  assert(
    _files[fileName] is _StringAsset,
    '"$fileName" was previously loaded as a binary file',
  );
  return (_files[fileName]! as _StringAsset).value;
}