summaryrefslogtreecommitdiff
path: root/lib/services/share_service.dart
diff options
context:
space:
mode:
Diffstat (limited to 'lib/services/share_service.dart')
-rw-r--r--lib/services/share_service.dart25
1 files changed, 25 insertions, 0 deletions
diff --git a/lib/services/share_service.dart b/lib/services/share_service.dart
new file mode 100644
index 0000000..36eb7af
--- /dev/null
+++ b/lib/services/share_service.dart
@@ -0,0 +1,25 @@
+import 'dart:io' show Platform;
+
+import 'package:flutter/services.dart';
+
+class ShareService {
+ static const _channel = MethodChannel('org.buetow.quicklog/share');
+
+ static Future<String?> readSharedTextFromCache() async {
+ if (!Platform.isAndroid) return null;
+ try {
+ return await _channel.invokeMethod<String>('readSharedTextFromCache');
+ } on MissingPluginException {
+ return null;
+ }
+ }
+
+ static Future<void> clearSharedTextCache() async {
+ if (!Platform.isAndroid) return;
+ try {
+ await _channel.invokeMethod<void>('clearSharedTextCache');
+ } on MissingPluginException {
+ // No-op: channel not registered (e.g. running on a non-Android target).
+ }
+ }
+}