workouttest_app/lib/library/network_image_to_byte.dart
2022-10-29 10:01:00 +02:00

14 lines
380 B
Dart

library network_image_to_byte;
import 'dart:io';
import 'package:flutter/foundation.dart';
Future<Uint8List> networkImageToByte(String path) async {
HttpClient httpClient = HttpClient();
var request = await httpClient.getUrl(Uri.parse(path));
var response = await request.close();
Uint8List bytes = await consolidateHttpClientResponseBytes(response);
return bytes;
}