elementOnLoad function

Future<bool> elementOnLoad(
  1. ImageElement img
)

Returns a Future<bool> for when img loads.

Implementation

Future<bool> elementOnLoad(ImageElement img) {
  var completer = Completer<bool>();
  img.onLoad.listen((e) => completer.complete(true),
      onError: (e) => completer.complete(false));
  return completer.future;
}