loadStringAsync function IO
Asynchronously loads a string from the specified url.
Delegates to the FileBackend for platform-specific loading.
Implementation
Future<String> loadStringAsync(String url, Loader loadingInfo, {FileBackend? fileBackend}) async {
final backend = fileBackend ?? _fileBackend;
if (backend == null) {
warn("FileBackend not initialized. Cannot load: $url");
return "";
}
var loadingState = loadingInfo.add(url);
try {
final content = await backend.loadString(url);
loadingState.completedOrFailed = true;
return content;
} catch (e) {
warn("Could not load: $url ($e)");
loadingState.completedOrFailed = true;
return "";
}
}