intent receiver plugin initial
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
|
||||
import 'simple_intent_receiver_platform_interface.dart';
|
||||
|
||||
class SimpleIntentReceiver {
|
||||
Future<String?> getPlatformVersion() {
|
||||
return SimpleIntentReceiverPlatform.instance.getPlatformVersion();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'simple_intent_receiver_platform_interface.dart';
|
||||
|
||||
/// An implementation of [SimpleIntentReceiverPlatform] that uses method channels.
|
||||
class MethodChannelSimpleIntentReceiver extends SimpleIntentReceiverPlatform {
|
||||
/// The method channel used to interact with the native platform.
|
||||
@visibleForTesting
|
||||
final methodChannel = const MethodChannel('simple_intent_receiver');
|
||||
|
||||
@override
|
||||
Future<String?> getPlatformVersion() async {
|
||||
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
|
||||
return version;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
|
||||
import 'simple_intent_receiver_method_channel.dart';
|
||||
|
||||
abstract class SimpleIntentReceiverPlatform extends PlatformInterface {
|
||||
/// Constructs a SimpleIntentReceiverPlatform.
|
||||
SimpleIntentReceiverPlatform() : super(token: _token);
|
||||
|
||||
static final Object _token = Object();
|
||||
|
||||
static SimpleIntentReceiverPlatform _instance = MethodChannelSimpleIntentReceiver();
|
||||
|
||||
/// The default instance of [SimpleIntentReceiverPlatform] to use.
|
||||
///
|
||||
/// Defaults to [MethodChannelSimpleIntentReceiver].
|
||||
static SimpleIntentReceiverPlatform get instance => _instance;
|
||||
|
||||
/// Platform-specific implementations should set this with their own
|
||||
/// platform-specific class that extends [SimpleIntentReceiverPlatform] when
|
||||
/// they register themselves.
|
||||
static set instance(SimpleIntentReceiverPlatform instance) {
|
||||
PlatformInterface.verifyToken(instance, _token);
|
||||
_instance = instance;
|
||||
}
|
||||
|
||||
Future<String?> getPlatformVersion() {
|
||||
throw UnimplementedError('platformVersion() has not been implemented.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user