adding in initial plugin code
This commit is contained in:
@@ -0,0 +1,8 @@
|
||||
|
||||
import 'multimedia_platform_interface.dart';
|
||||
|
||||
class Multimedia {
|
||||
Future<String?> getPlatformVersion() {
|
||||
return MultimediaPlatform.instance.getPlatformVersion();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'multimedia_platform_interface.dart';
|
||||
|
||||
/// An implementation of [MultimediaPlatform] that uses method channels.
|
||||
class MethodChannelMultimedia extends MultimediaPlatform {
|
||||
/// The method channel used to interact with the native platform.
|
||||
@visibleForTesting
|
||||
final methodChannel = const MethodChannel('multimedia');
|
||||
|
||||
@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 'multimedia_method_channel.dart';
|
||||
|
||||
abstract class MultimediaPlatform extends PlatformInterface {
|
||||
/// Constructs a MultimediaPlatform.
|
||||
MultimediaPlatform() : super(token: _token);
|
||||
|
||||
static final Object _token = Object();
|
||||
|
||||
static MultimediaPlatform _instance = MethodChannelMultimedia();
|
||||
|
||||
/// The default instance of [MultimediaPlatform] to use.
|
||||
///
|
||||
/// Defaults to [MethodChannelMultimedia].
|
||||
static MultimediaPlatform get instance => _instance;
|
||||
|
||||
/// Platform-specific implementations should set this with their own
|
||||
/// platform-specific class that extends [MultimediaPlatform] when
|
||||
/// they register themselves.
|
||||
static set instance(MultimediaPlatform instance) {
|
||||
PlatformInterface.verifyToken(instance, _token);
|
||||
_instance = instance;
|
||||
}
|
||||
|
||||
Future<String?> getPlatformVersion() {
|
||||
throw UnimplementedError('platformVersion() has not been implemented.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user