diff options
Diffstat (limited to 'lib/services/widget_service.dart')
| -rw-r--r-- | lib/services/widget_service.dart | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/lib/services/widget_service.dart b/lib/services/widget_service.dart new file mode 100644 index 0000000..21d1181 --- /dev/null +++ b/lib/services/widget_service.dart @@ -0,0 +1,30 @@ +import 'package:aves/services/common/channel.dart'; +import 'package:aves/services/common/services.dart'; +import 'package:flutter/services.dart'; + +class WidgetService { + static const _configureChannel = AvesMethodChannel('deckers.thibault/aves/widget_configure'); + static const _updateChannel = AvesMethodChannel('deckers.thibault/aves/widget_update'); + + static Future<bool> configure() async { + try { + await _configureChannel.invokeMethod('configure'); + return true; + } on PlatformException catch (e, stack) { + await reportService.recordError(e, stack); + } + return false; + } + + static Future<bool> update(int widgetId) async { + try { + await _updateChannel.invokeMethod('update', <String, dynamic>{ + 'widgetId': widgetId, + }); + return true; + } on PlatformException catch (e, stack) { + await reportService.recordError(e, stack); + } + return false; + } +} |
