apple_pay_platform_interface.dart 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. import 'package:plugin_platform_interface/plugin_platform_interface.dart';
  2. import 'apple_pay_method_channel.dart';
  3. abstract class ApplePayPlatform extends PlatformInterface {
  4. /// Constructs a ApplePayPlatform.
  5. ApplePayPlatform() : super(token: _token);
  6. static final Object _token = Object();
  7. static ApplePayPlatform _instance = MethodChannelApplePay();
  8. /// The default instance of [ApplePayPlatform] to use.
  9. ///
  10. /// Defaults to [MethodChannelApplePay].
  11. static ApplePayPlatform get instance => _instance;
  12. /// Platform-specific implementations should set this with their own
  13. /// platform-specific class that extends [ApplePayPlatform] when
  14. /// they register themselves.
  15. static set instance(ApplePayPlatform instance) {
  16. PlatformInterface.verifyToken(instance, _token);
  17. _instance = instance;
  18. }
  19. Future<String?> getPlatformVersion() {
  20. throw UnimplementedError('platformVersion() has not been implemented.');
  21. }
  22. /// 发起购买
  23. Future<Map<String, dynamic>> purchase({
  24. required String productId,
  25. String? appAccountToken,
  26. }) async {
  27. throw UnimplementedError('purchase() has not been implemented.');
  28. }
  29. /// 恢复订阅
  30. Future<Map<String, dynamic>> restore() async {
  31. throw UnimplementedError('restore() has not been implemented.');
  32. }
  33. /// 检查订单
  34. Future<bool> check(String appleId) async {
  35. throw UnimplementedError('check() has not been implemented.');
  36. }
  37. }