shortcut_platform_interface.dart 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. import 'package:plugin_platform_interface/plugin_platform_interface.dart';
  2. import 'package:shortcut/shortcut_method_channel.dart';
  3. abstract class FlutterShortcutPlatform extends PlatformInterface {
  4. /// Constructs a FlutterShortcutPlatform.
  5. FlutterShortcutPlatform() : super(token: _token);
  6. static final Object _token = Object();
  7. static FlutterShortcutPlatform _instance = MethodChannelFlutterShortcut();
  8. /// The default instance of [FlutterPinnedShortcutPlatform] to use.
  9. ///
  10. /// Defaults to [MethodChannelFlutterPinnedShortcut].
  11. static FlutterShortcutPlatform get instance => _instance;
  12. /// Platform-specific implementations should set this with their own
  13. /// platform-specific class that extends [FlutterPinnedShortcutPlatform] when
  14. /// they register themselves.
  15. static set instance(FlutterShortcutPlatform instance) {
  16. PlatformInterface.verifyToken(instance, _token);
  17. _instance = instance;
  18. }
  19. Future<String?> createShortcut({
  20. required String id,
  21. required String label,
  22. required String action,
  23. String? iconAssetName,
  24. }) async {
  25. throw UnimplementedError('platformVersion() has not been implemented.');
  26. }
  27. Stream<String> actionStream() {
  28. throw UnimplementedError('actionStream() has not been implemented.');
  29. }
  30. void getLaunchAction(void Function(String action) onActionReceived) {
  31. throw UnimplementedError('platformVersion() has not been implemented.');
  32. }
  33. }