loadStructuredData<T> method

Future<T> loadStructuredData<T>(
  1. String key,
  2. Future<T> parser(
    1. String value
    )
)

Retrieve a string from the asset bundle, parse it with the given function, and return that function's result.

The result is not cached by the default implementation; the parser is run each time the resource is fetched. However, some subclasses may implement caching (notably, subclasses of CachingAssetBundle).

Implementation

Future<T> loadStructuredData<T>(String key, Future<T> Function(String value) parser) async {
  return parser(await loadString(key));
}