workouttest_app/lib/library/network_image_to_byte.dart
2021-04-02 11:42:26 +02:00

15 lines
406 B
Dart

library network_image_to_byte;
import 'dart:io';
import 'dart:typed_data';
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;
}