loadStructuredData<T> method
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
@override
Future<T> loadStructuredData<T>(
String key, Future<T> Function(String value) parser) {
if (!_enableStructuredDataTracing) {
return _bundle.loadStructuredData(key, parser);
}
final outerSpan = _hub.getSpan();
return _wrapLoad(
outerSpan,
'loadStructuredData',
key,
() => _bundle.loadStructuredData(
key,
(value) => _wrapParser(
outerSpan,
key,
() => parser(value),
),
),
);
}