loadFromNetwork static method

Future<TouchBarImage> loadFromNetwork({
  1. required Uri url,
  2. String? key,
})

Create an instance of TouchBarImage from a remote url with a key.

Example:

TouchBarImage(url: 'https://picsum.photos/24')

key must be unique, if none is provided the url will be used as the key value.

Implementation

static Future<TouchBarImage> loadFromNetwork({
  required Uri url,
  String? key,
}) async {
  if (key == null) key = url.toString();

  ByteData data = await NetworkAssetBundle(url).load(
    '${url.path}?${url.query}',
  );
  return TouchBarImage(key: key, data: data);
}