startBubbleWidget method
Puts app in background and shows a floating widget overlay.
Supported keys inside widgetData on Android are:
- title
- subtitle
- value
- badge
template controls size and density of the widget card.
Use BubbleWidgetTemplate.small, BubbleWidgetTemplate.medium,
or BubbleWidgetTemplate.large.
Implementation
Future<void> startBubbleWidget({
bool sendAppToBackground = true,
Map<String, dynamic>? widgetData,
String template = BubbleWidgetTemplate.medium,
}) async {
try {
await _channel.invokeMethod('startBubbleWidget', {
'bounce': shouldBounce,
'showClose': showCloseButton,
'dragToClose': allowDragToClose,
'sendAppToBackground': sendAppToBackground,
'widgetData': widgetData ?? <String, dynamic>{},
'template': template,
});
} catch (e) {
print('❌ Error starting bubble widget: $e');
rethrow;
}
}