loadNetwork method

Future<bool> loadNetwork(
  1. String serverpathImages,
  2. String name
)

Implementation

Future<bool> loadNetwork(String serverpathImages, String name) async {
  final completer = Completer<ImageInfo>();
  final img = NetworkImage(serverpathImages + name);
  img
      .resolve(const ImageConfiguration())
      .addListener(ImageStreamListener((info, _) {
    completer.complete(info);
  }));
  ImageInfo imageInfo = await completer.future;
  uiimage = imageInfo.image;
  pngBytes = (await uiimage.toByteData(format: ui.ImageByteFormat.png))!;
  ByteData openglBytes =
      (await uiimage.toByteData(format: ui.ImageByteFormat.rawUnmodified))!;
  data = openglBytes.buffer.asUint8List();

  loaded = true;
  toVideoMemory();
  return true;
}