startBubbleHead method
puts app in background and shows floaty-bubble head
Implementation
Future<void> startBubbleHead({
bool sendAppToBackground = true,
String? iconPath,
}) async {
try {
// Use provided iconPath, or instance customIconPath, or default
String finalIconPath =
iconPath ?? customIconPath ?? 'assets/images/icon.png';
ByteData bytes = await rootBundle.load(finalIconPath);
var buffer = bytes.buffer;
var encodedImage = base64.encode(Uint8List.view(buffer));
await _channel.invokeMethod('startBubbleHead', {
"image": encodedImage,
"bounce": shouldBounce,
"showClose": showCloseButton,
"dragToClose": allowDragToClose,
"sendAppToBackground": sendAppToBackground,
});
print('✅ Bubble started with icon: $finalIconPath');
} catch (e) {
print('❌ Error starting bubble: $e');
rethrow;
}
}