flutter_push_platform_interface.dart 2.12 KB
import 'package:plugin_platform_interface/plugin_platform_interface.dart';

import 'flutter_push_method_channel.dart';
import 'mix_push_plugin_listener.dart';

abstract class FlutterPushPlatform extends PlatformInterface {
  /// Constructs a FlutterPushPlatform.
  FlutterPushPlatform() : super(token: _token);

  static final Object _token = Object();

  static FlutterPushPlatform _instance = MethodChannelFlutterPush();

  /// The default instance of [FlutterPushPlatform] to use.
  ///
  /// Defaults to [MethodChannelFlutterPush].
  static FlutterPushPlatform get instance => _instance;

  /// Platform-specific implementations should set this with their own
  /// platform-specific class that extends [FlutterPushPlatform] when
  /// they register themselves.
  static set instance(FlutterPushPlatform instance) {
    PlatformInterface.verifyToken(instance, _token);
    _instance = instance;
  }

  Future<String?> getPlatformVersion() {
    throw UnimplementedError('platformVersion() has not been implemented.');
  }



  /// 初始化,如果没有appId或appKey,请登录小米开发者中心申请
  /// [appId] 应用appId
  /// [appKey] 应用appKey
  Future<void> init({
    String? defaultPlatform,
    String? appId,
    String? appKey,
  }) async {
    throw UnimplementedError('init() has not been implemented.');
  }

  Future<bool> checkPermission() async {
    throw UnimplementedError('checkPermission() has not been implemented.');
  }

  Future<bool> getPermission() async {
    throw UnimplementedError('getPermission() has not been implemented.');
  }

  /// 添加消息监听
  void addListener(ListenerValue func) {
    throw UnimplementedError('addListener() has not been implemented.');
  }

  /// 移除消息监听
  void removeListener(ListenerValue func) {
    throw UnimplementedError('removeListener() has not been implemented.');
  }

  /// 获取客户端的 RegId
  Future<String?> getRegId() async {
    throw UnimplementedError('getRegId() has not been implemented.');
  }

  /// 获取客户端的 RegId
  Future<String?> msgReceive() async {
    throw UnimplementedError('msgReceive() has not been implemented.');
  }
}