Future<String?> toBase64() async { final pngBytes = await toBytes(); if (pngBytes == null) { return null; } return base64Encode(pngBytes); }