Initial commit with local development content
This commit is contained in:
14
lib/flutter_cocos_view.dart
Normal file
14
lib/flutter_cocos_view.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
// You have generated a new plugin project without specifying the `--platforms`
|
||||
// flag. A plugin project with no platform support was generated. To add a
|
||||
// platform, run `flutter create -t plugin --platforms <platforms> .` under the
|
||||
// same directory. You can also find a detailed instruction on how to add
|
||||
// platforms in the `pubspec.yaml` at
|
||||
// https://flutter.dev/to/pubspec-plugin-platforms.
|
||||
|
||||
import 'flutter_cocos_view_platform_interface.dart';
|
||||
|
||||
class FlutterCocosView {
|
||||
Future<String?> getPlatformVersion() {
|
||||
return FlutterCocosViewPlatform.instance.getPlatformVersion();
|
||||
}
|
||||
}
|
||||
17
lib/flutter_cocos_view_method_channel.dart
Normal file
17
lib/flutter_cocos_view_method_channel.dart
Normal file
@@ -0,0 +1,17 @@
|
||||
import 'package:flutter/foundation.dart';
|
||||
import 'package:flutter/services.dart';
|
||||
|
||||
import 'flutter_cocos_view_platform_interface.dart';
|
||||
|
||||
/// An implementation of [FlutterCocosViewPlatform] that uses method channels.
|
||||
class MethodChannelFlutterCocosView extends FlutterCocosViewPlatform {
|
||||
/// The method channel used to interact with the native platform.
|
||||
@visibleForTesting
|
||||
final methodChannel = const MethodChannel('flutter_cocos_view');
|
||||
|
||||
@override
|
||||
Future<String?> getPlatformVersion() async {
|
||||
final version = await methodChannel.invokeMethod<String>('getPlatformVersion');
|
||||
return version;
|
||||
}
|
||||
}
|
||||
29
lib/flutter_cocos_view_platform_interface.dart
Normal file
29
lib/flutter_cocos_view_platform_interface.dart
Normal file
@@ -0,0 +1,29 @@
|
||||
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
|
||||
|
||||
import 'flutter_cocos_view_method_channel.dart';
|
||||
|
||||
abstract class FlutterCocosViewPlatform extends PlatformInterface {
|
||||
/// Constructs a FlutterCocosViewPlatform.
|
||||
FlutterCocosViewPlatform() : super(token: _token);
|
||||
|
||||
static final Object _token = Object();
|
||||
|
||||
static FlutterCocosViewPlatform _instance = MethodChannelFlutterCocosView();
|
||||
|
||||
/// The default instance of [FlutterCocosViewPlatform] to use.
|
||||
///
|
||||
/// Defaults to [MethodChannelFlutterCocosView].
|
||||
static FlutterCocosViewPlatform get instance => _instance;
|
||||
|
||||
/// Platform-specific implementations should set this with their own
|
||||
/// platform-specific class that extends [FlutterCocosViewPlatform] when
|
||||
/// they register themselves.
|
||||
static set instance(FlutterCocosViewPlatform instance) {
|
||||
PlatformInterface.verifyToken(instance, _token);
|
||||
_instance = instance;
|
||||
}
|
||||
|
||||
Future<String?> getPlatformVersion() {
|
||||
throw UnimplementedError('platformVersion() has not been implemented.');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user