getStringData method

Future<String?> getStringData(
  1. String key,
  2. Future<String> parser(
    1. String value
    )
)

Retrieve a String by its Key value. Supply a parser function to process the operation. (See. Flutter's AssetBundle.loadStructuredData

Implementation

Future<String?> getStringData(
    String key, Future<String> Function(String value) parser) async {
  assert(Assets._assets != null, 'Assets.init() must be called first.');
  String? data;
  try {
    data =
        await Assets._assets!.loadStructuredData('$setPath(key)$key', parser);
  } catch (ex) {
    data = null;
  }
  return data;
}