loadStringAsync function IO

Future<String> loadStringAsync(
  1. String url,
  2. Loader loadingInfo
)

Asynchronously loads a string from the specified url.

Parameters:

  • url: The URL of the file to load.
  • loadingInfo: A Loader instance to track the loading progress.

Returns a Future that completes with the string content of the file. If the file cannot be loaded, the future completes with an empty string.

Implementation

Future<String> loadStringAsync(String url, Loader loadingInfo) async {
  return load<String>(
    url,
    loadingInfo,
    responseType: "text",
    defaultValue: "",
    onError: null,
    onLoad: (response, complete, error) {
      complete((response as JSString).toDart);
    },
  );
}