saveImage method Null safety

Future<String> saveImage(
  1. Uint8List image
)

Saves the image to the device.

Returns a Future<String>.

Implementation

static Future<String> saveImage(Uint8List image) async {
  await [Permission.storage].request();

  final timestamp = DateTime.now()
      .toIso8601String()
      .replaceAll('.', '-')
      .replaceAll(':', '-');
  final name = 'screenshot_$timestamp';
  final result = await ImageGallerySaver.saveImage(image, name: name);

  return result['filePath'];
}