device_utils_my_method_channel.dart 1 KB

import 'dart:async';

import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';

import 'device_utils_my_platform_interface.dart';

/// An implementation of [DeviceUtilsMyPlatform] that uses method channels.
class MethodChannelDeviceUtilsMy extends DeviceUtilsMyPlatform {
  /// The method channel used to interact with the native platform.
  @visibleForTesting
  final methodChannel = const MethodChannel('device_utils_my');

  @override
  Future<String?> getPlatformVersion() async {
    final version =
        await methodChannel.invokeMethod<String>('getPlatformVersion');
    return version;
  }

  @override
  Future<bool?> checkInstallPermission() async {
    final installPermission =
        await methodChannel.invokeMethod<bool>('checkInstallPermission');
    return installPermission;
  }
  
  @override
  Future<bool?> openPackageInstall() async {
    final openPackageInstall =
        await methodChannel.invokeMethod<bool>('openPackageInstall');
    return openPackageInstall;
  }
}