顾海波

【需求】初始

Showing 47 changed files with 1243 additions and 0 deletions
  1 +# Miscellaneous
  2 +*.class
  3 +*.log
  4 +*.pyc
  5 +*.swp
  6 +.DS_Store
  7 +.atom/
  8 +.buildlog/
  9 +.history
  10 +.svn/
  11 +migrate_working_dir/
  12 +
  13 +# IntelliJ related
  14 +*.iml
  15 +*.ipr
  16 +*.iws
  17 +.idea/
  18 +
  19 +# The .vscode folder contains launch configuration and tasks you configure in
  20 +# VS Code which you may wish to be included in version control, so this line
  21 +# is commented out by default.
  22 +#.vscode/
  23 +
  24 +# Flutter/Dart/Pub related
  25 +# Libraries should not include pubspec.lock, per https://dart.dev/guides/libraries/private-files#pubspeclock.
  26 +/pubspec.lock
  27 +**/doc/api/
  28 +.dart_tool/
  29 +build/
  1 +# This file tracks properties of this Flutter project.
  2 +# Used by Flutter tool to assess capabilities and perform upgrades etc.
  3 +#
  4 +# This file should be version controlled and should not be manually edited.
  5 +
  6 +version:
  7 + revision: "2f5301dec020b63b52835fe0be812d3429dadff7"
  8 + channel: "oh-3.22.0"
  9 +
  10 +project_type: plugin
  11 +
  12 +# Tracks metadata for the flutter migrate command
  13 +migration:
  14 + platforms:
  15 + - platform: root
  16 + create_revision: 2f5301dec020b63b52835fe0be812d3429dadff7
  17 + base_revision: 2f5301dec020b63b52835fe0be812d3429dadff7
  18 + - platform: android
  19 + create_revision: 2f5301dec020b63b52835fe0be812d3429dadff7
  20 + base_revision: 2f5301dec020b63b52835fe0be812d3429dadff7
  21 +
  22 + # User provided section
  23 +
  24 + # List of Local paths (relative to this file) that should be
  25 + # ignored by the migrate tool.
  26 + #
  27 + # Files that are not part of the templates will be ignored by default.
  28 + unmanaged_files:
  29 + - 'lib/main.dart'
  30 + - 'ios/Runner.xcodeproj/project.pbxproj'
  1 +## 0.0.1
  2 +
  3 +* TODO: Describe initial release.
  1 +TODO: Add your license here.
  1 +# flutter_channel
  2 +
  3 +A new Flutter project.
  4 +
  5 +## Getting Started
  6 +
  7 +This project is a starting point for a Flutter
  8 +[plug-in package](https://flutter.dev/developing-packages/),
  9 +a specialized package that includes platform-specific implementation code for
  10 +Android and/or iOS.
  11 +
  12 +For help getting started with Flutter development, view the
  13 +[online documentation](https://flutter.dev/docs), which offers tutorials,
  14 +samples, guidance on mobile development, and a full API reference.
  15 +
  1 +include: package:flutter_lints/flutter.yaml
  2 +
  3 +# Additional information about this file can be found at
  4 +# https://dart.dev/guides/language/analysis-options
  1 +*.iml
  2 +.gradle
  3 +/local.properties
  4 +/.idea/workspace.xml
  5 +/.idea/libraries
  6 +.DS_Store
  7 +/build
  8 +/captures
  9 +.cxx
  1 +group = "com.ewin.flutter_channel"
  2 +version = "1.0-SNAPSHOT"
  3 +
  4 +buildscript {
  5 + ext.kotlin_version = "1.7.10"
  6 + repositories {
  7 + google()
  8 + mavenCentral()
  9 + }
  10 +
  11 + dependencies {
  12 + classpath("com.android.tools.build:gradle:7.3.0")
  13 + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version")
  14 + }
  15 +}
  16 +
  17 +allprojects {
  18 + repositories {
  19 + google()
  20 + mavenCentral()
  21 + }
  22 +}
  23 +
  24 +apply plugin: "com.android.library"
  25 +apply plugin: "kotlin-android"
  26 +
  27 +android {
  28 + if (project.android.hasProperty("namespace")) {
  29 + namespace = "com.ewin.flutter_channel"
  30 + }
  31 +
  32 + compileSdk = 34
  33 +
  34 + compileOptions {
  35 + sourceCompatibility = JavaVersion.VERSION_1_8
  36 + targetCompatibility = JavaVersion.VERSION_1_8
  37 + }
  38 +
  39 + kotlinOptions {
  40 + jvmTarget = "1.8"
  41 + }
  42 +
  43 + sourceSets {
  44 + main.java.srcDirs += "src/main/kotlin"
  45 + test.java.srcDirs += "src/test/kotlin"
  46 + }
  47 +
  48 + defaultConfig {
  49 + minSdk = 21
  50 + }
  51 +
  52 + dependencies {
  53 + testImplementation("org.jetbrains.kotlin:kotlin-test")
  54 + testImplementation("org.mockito:mockito-core:5.0.0")
  55 + implementation("com.tencent.vasdolly:helper:3.0.6")
  56 + }
  57 +
  58 + testOptions {
  59 + unitTests.all {
  60 + useJUnitPlatform()
  61 +
  62 + testLogging {
  63 + events "passed", "skipped", "failed", "standardOut", "standardError"
  64 + outputs.upToDateWhen {false}
  65 + showStandardStreams = true
  66 + }
  67 + }
  68 + }
  69 +}
No preview for this file type
  1 +distributionBase=GRADLE_USER_HOME
  2 +distributionPath=wrapper/dists
  3 +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
  4 +networkTimeout=10000
  5 +validateDistributionUrl=true
  6 +zipStoreBase=GRADLE_USER_HOME
  7 +zipStorePath=wrapper/dists
  1 +rootProject.name = 'flutter_channel'
  1 +<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  2 + package="com.ewin.flutter_channel">
  3 +</manifest>
  1 +package com.ewin.flutter_channel
  2 +
  3 +import androidx.annotation.NonNull
  4 +import android.content.Context
  5 +
  6 +import io.flutter.embedding.engine.plugins.FlutterPlugin
  7 +import io.flutter.plugin.common.MethodCall
  8 +import io.flutter.plugin.common.MethodChannel
  9 +import io.flutter.plugin.common.MethodChannel.MethodCallHandler
  10 +import io.flutter.plugin.common.MethodChannel.Result
  11 +import com.tencent.vasdolly.helper.ChannelReaderUtil
  12 +
  13 +/** FlutterChannelPlugin */
  14 +class FlutterChannelPlugin: FlutterPlugin, MethodCallHandler {
  15 + /// The MethodChannel that will the communication between Flutter and native Android
  16 + ///
  17 + /// This local reference serves to register the plugin with the Flutter Engine and unregister it
  18 + /// when the Flutter Engine is detached from the Activity
  19 + private lateinit var channel : MethodChannel
  20 + private lateinit var context : Context
  21 +
  22 + override fun onAttachedToEngine(flutterPluginBinding: FlutterPlugin.FlutterPluginBinding) {
  23 + channel = MethodChannel(flutterPluginBinding.binaryMessenger, "flutter_channel")
  24 + channel.setMethodCallHandler(this)
  25 + context = flutterPluginBinding.applicationContext
  26 + }
  27 +
  28 + override fun onMethodCall(call: MethodCall, result: Result) {
  29 + if (call.method == "getChannel") {
  30 + val appChannel = ChannelReaderUtil.getChannel(context)
  31 + result.success(appChannel)
  32 + } else {
  33 + result.notImplemented()
  34 + }
  35 + }
  36 +
  37 + override fun onDetachedFromEngine(binding: FlutterPlugin.FlutterPluginBinding) {
  38 + channel.setMethodCallHandler(null)
  39 + }
  40 +}
  1 +package com.ewin.flutter_channel
  2 +
  3 +import io.flutter.plugin.common.MethodCall
  4 +import io.flutter.plugin.common.MethodChannel
  5 +import kotlin.test.Test
  6 +import org.mockito.Mockito
  7 +
  8 +/*
  9 + * This demonstrates a simple unit test of the Kotlin portion of this plugin's implementation.
  10 + *
  11 + * Once you have built the plugin's example app, you can run these tests from the command
  12 + * line by running `./gradlew testDebugUnitTest` in the `example/android/` directory, or
  13 + * you can run them directly from IDEs that support JUnit such as Android Studio.
  14 + */
  15 +
  16 +internal class FlutterChannelPluginTest {
  17 + @Test
  18 + fun onMethodCall_getChannel_returnsExpectedValue() {
  19 + val plugin = FlutterChannelPlugin()
  20 +
  21 + val call = MethodCall("getChannel", null)
  22 + val mockResult: MethodChannel.Result = Mockito.mock(MethodChannel.Result::class.java)
  23 + plugin.onMethodCall(call, mockResult)
  24 +
  25 + Mockito.verify(mockResult).success("Android " + android.os.Build.VERSION.RELEASE)
  26 + }
  27 +}
  1 +# Miscellaneous
  2 +*.class
  3 +*.log
  4 +*.pyc
  5 +*.swp
  6 +.DS_Store
  7 +.atom/
  8 +.buildlog/
  9 +.history
  10 +.svn/
  11 +migrate_working_dir/
  12 +
  13 +# IntelliJ related
  14 +*.iml
  15 +*.ipr
  16 +*.iws
  17 +.idea/
  18 +
  19 +# The .vscode folder contains launch configuration and tasks you configure in
  20 +# VS Code which you may wish to be included in version control, so this line
  21 +# is commented out by default.
  22 +#.vscode/
  23 +
  24 +# Flutter/Dart/Pub related
  25 +**/doc/api/
  26 +**/ios/Flutter/.last_build_id
  27 +.dart_tool/
  28 +.flutter-plugins
  29 +.flutter-plugins-dependencies
  30 +.pub-cache/
  31 +.pub/
  32 +/build/
  33 +
  34 +# Symbolication related
  35 +app.*.symbols
  36 +
  37 +# Obfuscation related
  38 +app.*.map.json
  39 +
  40 +# Android Studio will place build artifacts here
  41 +/android/app/debug
  42 +/android/app/profile
  43 +/android/app/release
  1 +# flutter_channel_example
  2 +
  3 +Demonstrates how to use the flutter_channel plugin.
  4 +
  5 +## Getting Started
  6 +
  7 +This project is a starting point for a Flutter application.
  8 +
  9 +A few resources to get you started if this is your first Flutter project:
  10 +
  11 +- [Lab: Write your first Flutter app](https://docs.flutter.dev/get-started/codelab)
  12 +- [Cookbook: Useful Flutter samples](https://docs.flutter.dev/cookbook)
  13 +
  14 +For help getting started with Flutter development, view the
  15 +[online documentation](https://docs.flutter.dev/), which offers tutorials,
  16 +samples, guidance on mobile development, and a full API reference.
  1 +# This file configures the analyzer, which statically analyzes Dart code to
  2 +# check for errors, warnings, and lints.
  3 +#
  4 +# The issues identified by the analyzer are surfaced in the UI of Dart-enabled
  5 +# IDEs (https://dart.dev/tools#ides-and-editors). The analyzer can also be
  6 +# invoked from the command line by running `flutter analyze`.
  7 +
  8 +# The following line activates a set of recommended lints for Flutter apps,
  9 +# packages, and plugins designed to encourage good coding practices.
  10 +include: package:flutter_lints/flutter.yaml
  11 +
  12 +linter:
  13 + # The lint rules applied to this project can be customized in the
  14 + # section below to disable rules from the `package:flutter_lints/flutter.yaml`
  15 + # included above or to enable additional rules. A list of all available lints
  16 + # and their documentation is published at https://dart.dev/lints.
  17 + #
  18 + # Instead of disabling a lint rule for the entire project in the
  19 + # section below, it can also be suppressed for a single line of code
  20 + # or a specific dart file by using the `// ignore: name_of_lint` and
  21 + # `// ignore_for_file: name_of_lint` syntax on the line or in the file
  22 + # producing the lint.
  23 + rules:
  24 + # avoid_print: false # Uncomment to disable the `avoid_print` rule
  25 + # prefer_single_quotes: true # Uncomment to enable the `prefer_single_quotes` rule
  26 +
  27 +# Additional information about this file can be found at
  28 +# https://dart.dev/guides/language/analysis-options
  1 +gradle-wrapper.jar
  2 +/.gradle
  3 +/captures/
  4 +/gradlew
  5 +/gradlew.bat
  6 +/local.properties
  7 +GeneratedPluginRegistrant.java
  8 +
  9 +# Remember to never publicly share your keystore.
  10 +# See https://flutter.dev/docs/deployment/android#reference-the-keystore-from-the-app
  11 +key.properties
  12 +**/*.keystore
  13 +**/*.jks
  1 +plugins {
  2 + id "com.android.application"
  3 + id "kotlin-android"
  4 + // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
  5 + id "dev.flutter.flutter-gradle-plugin"
  6 +}
  7 +
  8 +def localProperties = new Properties()
  9 +def localPropertiesFile = rootProject.file("local.properties")
  10 +if (localPropertiesFile.exists()) {
  11 + localPropertiesFile.withReader("UTF-8") { reader ->
  12 + localProperties.load(reader)
  13 + }
  14 +}
  15 +
  16 +def flutterVersionCode = localProperties.getProperty("flutter.versionCode")
  17 +if (flutterVersionCode == null) {
  18 + flutterVersionCode = "1"
  19 +}
  20 +
  21 +def flutterVersionName = localProperties.getProperty("flutter.versionName")
  22 +if (flutterVersionName == null) {
  23 + flutterVersionName = "1.0"
  24 +}
  25 +
  26 +android {
  27 + namespace = "com.ewin.flutter_channel_example"
  28 + compileSdk = flutter.compileSdkVersion
  29 + ndkVersion = flutter.ndkVersion
  30 +
  31 + compileOptions {
  32 + sourceCompatibility = JavaVersion.VERSION_1_8
  33 + targetCompatibility = JavaVersion.VERSION_1_8
  34 + }
  35 +
  36 + defaultConfig {
  37 + // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
  38 + applicationId = "com.ewin.flutter_channel_example"
  39 + // You can update the following values to match your application needs.
  40 + // For more information, see: https://docs.flutter.dev/deployment/android#reviewing-the-gradle-build-configuration.
  41 + minSdk = flutter.minSdkVersion
  42 + targetSdk = flutter.targetSdkVersion
  43 + versionCode = flutterVersionCode.toInteger()
  44 + versionName = flutterVersionName
  45 + }
  46 +
  47 + buildTypes {
  48 + release {
  49 + // TODO: Add your own signing config for the release build.
  50 + // Signing with the debug keys for now, so `flutter run --release` works.
  51 + signingConfig = signingConfigs.debug
  52 + }
  53 + }
  54 +}
  55 +
  56 +flutter {
  57 + source = "../.."
  58 +}
  1 +<manifest xmlns:android="http://schemas.android.com/apk/res/android">
  2 + <!-- The INTERNET permission is required for development. Specifically,
  3 + the Flutter tool needs it to communicate with the running application
  4 + to allow setting breakpoints, to provide hot reload, etc.
  5 + -->
  6 + <uses-permission android:name="android.permission.INTERNET"/>
  7 +</manifest>
  1 +<manifest xmlns:android="http://schemas.android.com/apk/res/android">
  2 + <application
  3 + android:label="flutter_channel_example"
  4 + android:name="${applicationName}"
  5 + android:icon="@mipmap/ic_launcher">
  6 + <activity
  7 + android:name=".MainActivity"
  8 + android:exported="true"
  9 + android:launchMode="singleTop"
  10 + android:taskAffinity=""
  11 + android:theme="@style/LaunchTheme"
  12 + android:configChanges="orientation|keyboardHidden|keyboard|screenSize|smallestScreenSize|locale|layoutDirection|fontScale|screenLayout|density|uiMode"
  13 + android:hardwareAccelerated="true"
  14 + android:windowSoftInputMode="adjustResize">
  15 + <!-- Specifies an Android theme to apply to this Activity as soon as
  16 + the Android process has started. This theme is visible to the user
  17 + while the Flutter UI initializes. After that, this theme continues
  18 + to determine the Window background behind the Flutter UI. -->
  19 + <meta-data
  20 + android:name="io.flutter.embedding.android.NormalTheme"
  21 + android:resource="@style/NormalTheme"
  22 + />
  23 + <intent-filter>
  24 + <action android:name="android.intent.action.MAIN"/>
  25 + <category android:name="android.intent.category.LAUNCHER"/>
  26 + </intent-filter>
  27 + </activity>
  28 + <!-- Don't delete the meta-data below.
  29 + This is used by the Flutter tool to generate GeneratedPluginRegistrant.java -->
  30 + <meta-data
  31 + android:name="flutterEmbedding"
  32 + android:value="2" />
  33 + </application>
  34 + <!-- Required to query activities that can process text, see:
  35 + https://developer.android.com/training/package-visibility and
  36 + https://developer.android.com/reference/android/content/Intent#ACTION_PROCESS_TEXT.
  37 +
  38 + In particular, this is used by the Flutter engine in io.flutter.plugin.text.ProcessTextPlugin. -->
  39 + <queries>
  40 + <intent>
  41 + <action android:name="android.intent.action.PROCESS_TEXT"/>
  42 + <data android:mimeType="text/plain"/>
  43 + </intent>
  44 + </queries>
  45 +</manifest>
  1 +package com.ewin.flutter_channel_example
  2 +
  3 +import io.flutter.embedding.android.FlutterActivity
  4 +
  5 +class MainActivity: FlutterActivity()
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<!-- Modify this file to customize your launch splash screen -->
  3 +<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  4 + <item android:drawable="?android:colorBackground" />
  5 +
  6 + <!-- You can insert your own image assets here -->
  7 + <!-- <item>
  8 + <bitmap
  9 + android:gravity="center"
  10 + android:src="@mipmap/launch_image" />
  11 + </item> -->
  12 +</layer-list>
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<!-- Modify this file to customize your launch splash screen -->
  3 +<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
  4 + <item android:drawable="@android:color/white" />
  5 +
  6 + <!-- You can insert your own image assets here -->
  7 + <!-- <item>
  8 + <bitmap
  9 + android:gravity="center"
  10 + android:src="@mipmap/launch_image" />
  11 + </item> -->
  12 +</layer-list>
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<resources>
  3 + <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is on -->
  4 + <style name="LaunchTheme" parent="@android:style/Theme.Black.NoTitleBar">
  5 + <!-- Show a splash screen on the activity. Automatically removed when
  6 + the Flutter engine draws its first frame -->
  7 + <item name="android:windowBackground">@drawable/launch_background</item>
  8 + </style>
  9 + <!-- Theme applied to the Android Window as soon as the process has started.
  10 + This theme determines the color of the Android Window while your
  11 + Flutter UI initializes, as well as behind your Flutter UI while its
  12 + running.
  13 +
  14 + This Theme is only used starting with V2 of Flutter's Android embedding. -->
  15 + <style name="NormalTheme" parent="@android:style/Theme.Black.NoTitleBar">
  16 + <item name="android:windowBackground">?android:colorBackground</item>
  17 + </style>
  18 +</resources>
  1 +<?xml version="1.0" encoding="utf-8"?>
  2 +<resources>
  3 + <!-- Theme applied to the Android Window while the process is starting when the OS's Dark Mode setting is off -->
  4 + <style name="LaunchTheme" parent="@android:style/Theme.Light.NoTitleBar">
  5 + <!-- Show a splash screen on the activity. Automatically removed when
  6 + the Flutter engine draws its first frame -->
  7 + <item name="android:windowBackground">@drawable/launch_background</item>
  8 + </style>
  9 + <!-- Theme applied to the Android Window as soon as the process has started.
  10 + This theme determines the color of the Android Window while your
  11 + Flutter UI initializes, as well as behind your Flutter UI while its
  12 + running.
  13 +
  14 + This Theme is only used starting with V2 of Flutter's Android embedding. -->
  15 + <style name="NormalTheme" parent="@android:style/Theme.Light.NoTitleBar">
  16 + <item name="android:windowBackground">?android:colorBackground</item>
  17 + </style>
  18 +</resources>
  1 +<manifest xmlns:android="http://schemas.android.com/apk/res/android">
  2 + <!-- The INTERNET permission is required for development. Specifically,
  3 + the Flutter tool needs it to communicate with the running application
  4 + to allow setting breakpoints, to provide hot reload, etc.
  5 + -->
  6 + <uses-permission android:name="android.permission.INTERNET"/>
  7 +</manifest>
  1 +allprojects {
  2 + repositories {
  3 + google()
  4 + mavenCentral()
  5 + }
  6 +}
  7 +
  8 +rootProject.buildDir = "../build"
  9 +subprojects {
  10 + project.buildDir = "${rootProject.buildDir}/${project.name}"
  11 +}
  12 +subprojects {
  13 + project.evaluationDependsOn(":app")
  14 +}
  15 +
  16 +tasks.register("clean", Delete) {
  17 + delete rootProject.buildDir
  18 +}
  1 +org.gradle.jvmargs=-Xmx4G -XX:+HeapDumpOnOutOfMemoryError
  2 +android.useAndroidX=true
  3 +android.enableJetifier=true
  1 +distributionBase=GRADLE_USER_HOME
  2 +distributionPath=wrapper/dists
  3 +zipStoreBase=GRADLE_USER_HOME
  4 +zipStorePath=wrapper/dists
  5 +distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.3-all.zip
  1 +pluginManagement {
  2 + def flutterSdkPath = {
  3 + def properties = new Properties()
  4 + file("local.properties").withInputStream { properties.load(it) }
  5 + def flutterSdkPath = properties.getProperty("flutter.sdk")
  6 + assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
  7 + return flutterSdkPath
  8 + }()
  9 +
  10 + includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")
  11 +
  12 + repositories {
  13 + google()
  14 + mavenCentral()
  15 + gradlePluginPortal()
  16 + }
  17 +}
  18 +
  19 +plugins {
  20 + id "dev.flutter.flutter-plugin-loader" version "1.0.0"
  21 + id "com.android.application" version "7.3.0" apply false
  22 + id "org.jetbrains.kotlin.android" version "1.7.10" apply false
  23 +}
  24 +
  25 +include ":app"
  1 +// This is a basic Flutter integration test.
  2 +//
  3 +// Since integration tests run in a full Flutter application, they can interact
  4 +// with the host side of a plugin implementation, unlike Dart unit tests.
  5 +//
  6 +// For more information about Flutter integration tests, please see
  7 +// https://docs.flutter.dev/cookbook/testing/integration/introduction
  8 +
  9 +
  10 +import 'package:flutter_test/flutter_test.dart';
  11 +import 'package:integration_test/integration_test.dart';
  12 +
  13 +import 'package:flutter_channel/flutter_channel.dart';
  14 +
  15 +void main() {
  16 + IntegrationTestWidgetsFlutterBinding.ensureInitialized();
  17 +
  18 + testWidgets('getChannel test', (WidgetTester tester) async {
  19 + final FlutterChannel plugin = FlutterChannel();
  20 + final String? version = await plugin.getChannel();
  21 + // The version string depends on the host platform running the test, so
  22 + // just assert that some non-empty string is returned.
  23 + expect(version?.isNotEmpty, true);
  24 + });
  25 +}
  1 +import 'package:flutter/material.dart';
  2 +import 'dart:async';
  3 +
  4 +import 'package:flutter/services.dart';
  5 +import 'package:flutter_channel/flutter_channel.dart';
  6 +
  7 +void main() {
  8 + runApp(const MyApp());
  9 +}
  10 +
  11 +class MyApp extends StatefulWidget {
  12 + const MyApp({super.key});
  13 +
  14 + @override
  15 + State<MyApp> createState() => _MyAppState();
  16 +}
  17 +
  18 +class _MyAppState extends State<MyApp> {
  19 + String _platformVersion = 'Unknown';
  20 + final _flutterChannelPlugin = FlutterChannel();
  21 +
  22 + @override
  23 + void initState() {
  24 + super.initState();
  25 + initPlatformState();
  26 + }
  27 +
  28 + // Platform messages are asynchronous, so we initialize in an async method.
  29 + Future<void> initPlatformState() async {
  30 + String platformVersion;
  31 + // Platform messages may fail, so we use a try/catch PlatformException.
  32 + // We also handle the message potentially returning null.
  33 + try {
  34 + platformVersion =
  35 + await _flutterChannelPlugin.getChannel() ?? 'Unknown platform version';
  36 + } on PlatformException {
  37 + platformVersion = 'Failed to get platform version.';
  38 + }
  39 +
  40 + // If the widget was removed from the tree while the asynchronous platform
  41 + // message was in flight, we want to discard the reply rather than calling
  42 + // setState to update our non-existent appearance.
  43 + if (!mounted) return;
  44 +
  45 + setState(() {
  46 + _platformVersion = platformVersion;
  47 + });
  48 + }
  49 +
  50 + @override
  51 + Widget build(BuildContext context) {
  52 + return MaterialApp(
  53 + home: Scaffold(
  54 + appBar: AppBar(
  55 + title: const Text('Plugin example app'),
  56 + ),
  57 + body: Center(
  58 + child: Text('Running on: $_platformVersion\n'),
  59 + ),
  60 + ),
  61 + );
  62 + }
  63 +}
  1 +# Generated by pub
  2 +# See https://dart.dev/tools/pub/glossary#lockfile
  3 +packages:
  4 + async:
  5 + dependency: transitive
  6 + description:
  7 + name: async
  8 + sha256: "947bfcf187f74dbc5e146c9eb9c0f10c9f8b30743e341481c1e2ed3ecc18c20c"
  9 + url: "https://pub.flutter-io.cn"
  10 + source: hosted
  11 + version: "2.11.0"
  12 + boolean_selector:
  13 + dependency: transitive
  14 + description:
  15 + name: boolean_selector
  16 + sha256: "6cfb5af12253eaf2b368f07bacc5a80d1301a071c73360d746b7f2e32d762c66"
  17 + url: "https://pub.flutter-io.cn"
  18 + source: hosted
  19 + version: "2.1.1"
  20 + characters:
  21 + dependency: transitive
  22 + description:
  23 + name: characters
  24 + sha256: "04a925763edad70e8443c99234dc3328f442e811f1d8fd1a72f1c8ad0f69a605"
  25 + url: "https://pub.flutter-io.cn"
  26 + source: hosted
  27 + version: "1.3.0"
  28 + clock:
  29 + dependency: transitive
  30 + description:
  31 + name: clock
  32 + sha256: cb6d7f03e1de671e34607e909a7213e31d7752be4fb66a86d29fe1eb14bfb5cf
  33 + url: "https://pub.flutter-io.cn"
  34 + source: hosted
  35 + version: "1.1.1"
  36 + collection:
  37 + dependency: transitive
  38 + description:
  39 + name: collection
  40 + sha256: ee67cb0715911d28db6bf4af1026078bd6f0128b07a5f66fb2ed94ec6783c09a
  41 + url: "https://pub.flutter-io.cn"
  42 + source: hosted
  43 + version: "1.18.0"
  44 + cupertino_icons:
  45 + dependency: "direct main"
  46 + description:
  47 + name: cupertino_icons
  48 + sha256: ba631d1c7f7bef6b729a622b7b752645a2d076dba9976925b8f25725a30e1ee6
  49 + url: "https://pub.flutter-io.cn"
  50 + source: hosted
  51 + version: "1.0.8"
  52 + fake_async:
  53 + dependency: transitive
  54 + description:
  55 + name: fake_async
  56 + sha256: "511392330127add0b769b75a987850d136345d9227c6b94c96a04cf4a391bf78"
  57 + url: "https://pub.flutter-io.cn"
  58 + source: hosted
  59 + version: "1.3.1"
  60 + file:
  61 + dependency: transitive
  62 + description:
  63 + name: file
  64 + sha256: "5fc22d7c25582e38ad9a8515372cd9a93834027aacf1801cf01164dac0ffa08c"
  65 + url: "https://pub.flutter-io.cn"
  66 + source: hosted
  67 + version: "7.0.0"
  68 + flutter:
  69 + dependency: "direct main"
  70 + description: flutter
  71 + source: sdk
  72 + version: "0.0.0"
  73 + flutter_channel:
  74 + dependency: "direct main"
  75 + description:
  76 + path: ".."
  77 + relative: true
  78 + source: path
  79 + version: "0.0.1"
  80 + flutter_driver:
  81 + dependency: transitive
  82 + description: flutter
  83 + source: sdk
  84 + version: "0.0.0"
  85 + flutter_lints:
  86 + dependency: "direct dev"
  87 + description:
  88 + name: flutter_lints
  89 + sha256: "9e8c3858111da373efc5aa341de011d9bd23e2c5c5e0c62bccf32438e192d7b1"
  90 + url: "https://pub.flutter-io.cn"
  91 + source: hosted
  92 + version: "3.0.2"
  93 + flutter_test:
  94 + dependency: "direct dev"
  95 + description: flutter
  96 + source: sdk
  97 + version: "0.0.0"
  98 + fuchsia_remote_debug_protocol:
  99 + dependency: transitive
  100 + description: flutter
  101 + source: sdk
  102 + version: "0.0.0"
  103 + integration_test:
  104 + dependency: "direct dev"
  105 + description: flutter
  106 + source: sdk
  107 + version: "0.0.0"
  108 + leak_tracker:
  109 + dependency: transitive
  110 + description:
  111 + name: leak_tracker
  112 + sha256: "7f0df31977cb2c0b88585095d168e689669a2cc9b97c309665e3386f3e9d341a"
  113 + url: "https://pub.flutter-io.cn"
  114 + source: hosted
  115 + version: "10.0.4"
  116 + leak_tracker_flutter_testing:
  117 + dependency: transitive
  118 + description:
  119 + name: leak_tracker_flutter_testing
  120 + sha256: "06e98f569d004c1315b991ded39924b21af84cf14cc94791b8aea337d25b57f8"
  121 + url: "https://pub.flutter-io.cn"
  122 + source: hosted
  123 + version: "3.0.3"
  124 + leak_tracker_testing:
  125 + dependency: transitive
  126 + description:
  127 + name: leak_tracker_testing
  128 + sha256: "6ba465d5d76e67ddf503e1161d1f4a6bc42306f9d66ca1e8f079a47290fb06d3"
  129 + url: "https://pub.flutter-io.cn"
  130 + source: hosted
  131 + version: "3.0.1"
  132 + lints:
  133 + dependency: transitive
  134 + description:
  135 + name: lints
  136 + sha256: cbf8d4b858bb0134ef3ef87841abdf8d63bfc255c266b7bf6b39daa1085c4290
  137 + url: "https://pub.flutter-io.cn"
  138 + source: hosted
  139 + version: "3.0.0"
  140 + matcher:
  141 + dependency: transitive
  142 + description:
  143 + name: matcher
  144 + sha256: d2323aa2060500f906aa31a895b4030b6da3ebdcc5619d14ce1aada65cd161cb
  145 + url: "https://pub.flutter-io.cn"
  146 + source: hosted
  147 + version: "0.12.16+1"
  148 + material_color_utilities:
  149 + dependency: transitive
  150 + description:
  151 + name: material_color_utilities
  152 + sha256: "0e0a020085b65b6083975e499759762399b4475f766c21668c4ecca34ea74e5a"
  153 + url: "https://pub.flutter-io.cn"
  154 + source: hosted
  155 + version: "0.8.0"
  156 + meta:
  157 + dependency: transitive
  158 + description:
  159 + name: meta
  160 + sha256: "7687075e408b093f36e6bbf6c91878cc0d4cd10f409506f7bc996f68220b9136"
  161 + url: "https://pub.flutter-io.cn"
  162 + source: hosted
  163 + version: "1.12.0"
  164 + path:
  165 + dependency: transitive
  166 + description:
  167 + name: path
  168 + sha256: "087ce49c3f0dc39180befefc60fdb4acd8f8620e5682fe2476afd0b3688bb4af"
  169 + url: "https://pub.flutter-io.cn"
  170 + source: hosted
  171 + version: "1.9.0"
  172 + platform:
  173 + dependency: transitive
  174 + description:
  175 + name: platform
  176 + sha256: "12220bb4b65720483f8fa9450b4332347737cf8213dd2840d8b2c823e47243ec"
  177 + url: "https://pub.flutter-io.cn"
  178 + source: hosted
  179 + version: "3.1.4"
  180 + plugin_platform_interface:
  181 + dependency: transitive
  182 + description:
  183 + name: plugin_platform_interface
  184 + sha256: "4820fbfdb9478b1ebae27888254d445073732dae3d6ea81f0b7e06d5dedc3f02"
  185 + url: "https://pub.flutter-io.cn"
  186 + source: hosted
  187 + version: "2.1.8"
  188 + process:
  189 + dependency: transitive
  190 + description:
  191 + name: process
  192 + sha256: "21e54fd2faf1b5bdd5102afd25012184a6793927648ea81eea80552ac9405b32"
  193 + url: "https://pub.flutter-io.cn"
  194 + source: hosted
  195 + version: "5.0.2"
  196 + sky_engine:
  197 + dependency: transitive
  198 + description: flutter
  199 + source: sdk
  200 + version: "0.0.99"
  201 + source_span:
  202 + dependency: transitive
  203 + description:
  204 + name: source_span
  205 + sha256: "53e943d4206a5e30df338fd4c6e7a077e02254531b138a15aec3bd143c1a8b3c"
  206 + url: "https://pub.flutter-io.cn"
  207 + source: hosted
  208 + version: "1.10.0"
  209 + stack_trace:
  210 + dependency: transitive
  211 + description:
  212 + name: stack_trace
  213 + sha256: "73713990125a6d93122541237550ee3352a2d84baad52d375a4cad2eb9b7ce0b"
  214 + url: "https://pub.flutter-io.cn"
  215 + source: hosted
  216 + version: "1.11.1"
  217 + stream_channel:
  218 + dependency: transitive
  219 + description:
  220 + name: stream_channel
  221 + sha256: ba2aa5d8cc609d96bbb2899c28934f9e1af5cddbd60a827822ea467161eb54e7
  222 + url: "https://pub.flutter-io.cn"
  223 + source: hosted
  224 + version: "2.1.2"
  225 + string_scanner:
  226 + dependency: transitive
  227 + description:
  228 + name: string_scanner
  229 + sha256: "556692adab6cfa87322a115640c11f13cb77b3f076ddcc5d6ae3c20242bedcde"
  230 + url: "https://pub.flutter-io.cn"
  231 + source: hosted
  232 + version: "1.2.0"
  233 + sync_http:
  234 + dependency: transitive
  235 + description:
  236 + name: sync_http
  237 + sha256: "7f0cd72eca000d2e026bcd6f990b81d0ca06022ef4e32fb257b30d3d1014a961"
  238 + url: "https://pub.flutter-io.cn"
  239 + source: hosted
  240 + version: "0.3.1"
  241 + term_glyph:
  242 + dependency: transitive
  243 + description:
  244 + name: term_glyph
  245 + sha256: a29248a84fbb7c79282b40b8c72a1209db169a2e0542bce341da992fe1bc7e84
  246 + url: "https://pub.flutter-io.cn"
  247 + source: hosted
  248 + version: "1.2.1"
  249 + test_api:
  250 + dependency: transitive
  251 + description:
  252 + name: test_api
  253 + sha256: "9955ae474176f7ac8ee4e989dadfb411a58c30415bcfb648fa04b2b8a03afa7f"
  254 + url: "https://pub.flutter-io.cn"
  255 + source: hosted
  256 + version: "0.7.0"
  257 + vector_math:
  258 + dependency: transitive
  259 + description:
  260 + name: vector_math
  261 + sha256: "80b3257d1492ce4d091729e3a67a60407d227c27241d6927be0130c98e741803"
  262 + url: "https://pub.flutter-io.cn"
  263 + source: hosted
  264 + version: "2.1.4"
  265 + vm_service:
  266 + dependency: transitive
  267 + description:
  268 + name: vm_service
  269 + sha256: "3923c89304b715fb1eb6423f017651664a03bf5f4b29983627c4da791f74a4ec"
  270 + url: "https://pub.flutter-io.cn"
  271 + source: hosted
  272 + version: "14.2.1"
  273 + webdriver:
  274 + dependency: transitive
  275 + description:
  276 + name: webdriver
  277 + sha256: "003d7da9519e1e5f329422b36c4dcdf18d7d2978d1ba099ea4e45ba490ed845e"
  278 + url: "https://pub.flutter-io.cn"
  279 + source: hosted
  280 + version: "3.0.3"
  281 +sdks:
  282 + dart: ">=3.4.0 <4.0.0"
  283 + flutter: ">=3.18.0-18.0.pre.54"
  1 +name: flutter_channel_example
  2 +description: "Demonstrates how to use the flutter_channel plugin."
  3 +# The following line prevents the package from being accidentally published to
  4 +# pub.dev using `flutter pub publish`. This is preferred for private packages.
  5 +publish_to: 'none' # Remove this line if you wish to publish to pub.dev
  6 +
  7 +environment:
  8 + sdk: '>=3.4.0 <4.0.0'
  9 +
  10 +# Dependencies specify other packages that your package needs in order to work.
  11 +# To automatically upgrade your package dependencies to the latest versions
  12 +# consider running `flutter pub upgrade --major-versions`. Alternatively,
  13 +# dependencies can be manually updated by changing the version numbers below to
  14 +# the latest version available on pub.dev. To see which dependencies have newer
  15 +# versions available, run `flutter pub outdated`.
  16 +dependencies:
  17 + flutter:
  18 + sdk: flutter
  19 +
  20 + flutter_channel:
  21 + # When depending on this package from a real application you should use:
  22 + # flutter_channel: ^x.y.z
  23 + # See https://dart.dev/tools/pub/dependencies#version-constraints
  24 + # The example app is bundled with the plugin so we use a path dependency on
  25 + # the parent directory to use the current plugin's version.
  26 + path: ../
  27 +
  28 + # The following adds the Cupertino Icons font to your application.
  29 + # Use with the CupertinoIcons class for iOS style icons.
  30 + cupertino_icons: ^1.0.6
  31 +
  32 +dev_dependencies:
  33 + integration_test:
  34 + sdk: flutter
  35 + flutter_test:
  36 + sdk: flutter
  37 +
  38 + # The "flutter_lints" package below contains a set of recommended lints to
  39 + # encourage good coding practices. The lint set provided by the package is
  40 + # activated in the `analysis_options.yaml` file located at the root of your
  41 + # package. See that file for information about deactivating specific lint
  42 + # rules and activating additional ones.
  43 + flutter_lints: ^3.0.0
  44 +
  45 +# For information on the generic Dart part of this file, see the
  46 +# following page: https://dart.dev/tools/pub/pubspec
  47 +
  48 +# The following section is specific to Flutter packages.
  49 +flutter:
  50 +
  51 + # The following line ensures that the Material Icons font is
  52 + # included with your application, so that you can use the icons in
  53 + # the material Icons class.
  54 + uses-material-design: true
  55 +
  56 + # To add assets to your application, add an assets section, like this:
  57 + # assets:
  58 + # - images/a_dot_burr.jpeg
  59 + # - images/a_dot_ham.jpeg
  60 +
  61 + # An image asset can refer to one or more resolution-specific "variants", see
  62 + # https://flutter.dev/assets-and-images/#resolution-aware
  63 +
  64 + # For details regarding adding assets from package dependencies, see
  65 + # https://flutter.dev/assets-and-images/#from-packages
  66 +
  67 + # To add custom fonts to your application, add a fonts section here,
  68 + # in this "flutter" section. Each entry in this list should have a
  69 + # "family" key with the font family name, and a "fonts" key with a
  70 + # list giving the asset and other descriptors for the font. For
  71 + # example:
  72 + # fonts:
  73 + # - family: Schyler
  74 + # fonts:
  75 + # - asset: fonts/Schyler-Regular.ttf
  76 + # - asset: fonts/Schyler-Italic.ttf
  77 + # style: italic
  78 + # - family: Trajan Pro
  79 + # fonts:
  80 + # - asset: fonts/TrajanPro.ttf
  81 + # - asset: fonts/TrajanPro_Bold.ttf
  82 + # weight: 700
  83 + #
  84 + # For details regarding fonts from package dependencies,
  85 + # see https://flutter.dev/custom-fonts/#from-packages
  1 +// This is a basic Flutter widget test.
  2 +//
  3 +// To perform an interaction with a widget in your test, use the WidgetTester
  4 +// utility in the flutter_test package. For example, you can send tap and scroll
  5 +// gestures. You can also use WidgetTester to find child widgets in the widget
  6 +// tree, read text, and verify that the values of widget properties are correct.
  7 +
  8 +import 'package:flutter/material.dart';
  9 +import 'package:flutter_test/flutter_test.dart';
  10 +
  11 +import 'package:flutter_channel_example/main.dart';
  12 +
  13 +void main() {
  14 + testWidgets('Verify Platform version', (WidgetTester tester) async {
  15 + // Build our app and trigger a frame.
  16 + await tester.pumpWidget(const MyApp());
  17 +
  18 + // Verify that platform version is retrieved.
  19 + expect(
  20 + find.byWidgetPredicate(
  21 + (Widget widget) => widget is Text &&
  22 + widget.data!.startsWith('Running on:'),
  23 + ),
  24 + findsOneWidget,
  25 + );
  26 + });
  27 +}
  1 +import 'dart:io';
  2 +
  3 +import 'flutter_channel_platform_interface.dart';
  4 +
  5 +class FlutterChannel {
  6 + Future<String?> getChannel() {
  7 + if (Platform.isAndroid) {
  8 + return FlutterChannelPlatform.instance.getChannel();
  9 + } else if (Platform.isIOS) {
  10 + return Future.value("ios");
  11 + } else if (Platform.operatingSystem == "ohos") {
  12 + return Future.value("ohos");
  13 + } else {
  14 + return Future.value("other");
  15 + }
  16 + }
  17 +}
  1 +import 'package:flutter/foundation.dart';
  2 +import 'package:flutter/services.dart';
  3 +
  4 +import 'flutter_channel_platform_interface.dart';
  5 +
  6 +/// An implementation of [FlutterChannelPlatform] that uses method channels.
  7 +class MethodChannelFlutterChannel extends FlutterChannelPlatform {
  8 + /// The method channel used to interact with the native platform.
  9 + @visibleForTesting
  10 + final methodChannel = const MethodChannel('flutter_channel');
  11 +
  12 + @override
  13 + Future<String?> getChannel() async {
  14 + final version = await methodChannel.invokeMethod<String>('getChannel');
  15 + return version;
  16 + }
  17 +}
  1 +import 'package:plugin_platform_interface/plugin_platform_interface.dart';
  2 +
  3 +import 'flutter_channel_method_channel.dart';
  4 +
  5 +abstract class FlutterChannelPlatform extends PlatformInterface {
  6 + /// Constructs a FlutterChannelPlatform.
  7 + FlutterChannelPlatform() : super(token: _token);
  8 +
  9 + static final Object _token = Object();
  10 +
  11 + static FlutterChannelPlatform _instance = MethodChannelFlutterChannel();
  12 +
  13 + /// The default instance of [FlutterChannelPlatform] to use.
  14 + ///
  15 + /// Defaults to [MethodChannelFlutterChannel].
  16 + static FlutterChannelPlatform get instance => _instance;
  17 +
  18 + /// Platform-specific implementations should set this with their own
  19 + /// platform-specific class that extends [FlutterChannelPlatform] when
  20 + /// they register themselves.
  21 + static set instance(FlutterChannelPlatform instance) {
  22 + PlatformInterface.verifyToken(instance, _token);
  23 + _instance = instance;
  24 + }
  25 +
  26 + Future<String?> getChannel() {
  27 + throw UnimplementedError('platformVersion() has not been implemented.');
  28 + }
  29 +}
  1 +name: flutter_channel
  2 +description: "A new Flutter project."
  3 +version: 0.0.1
  4 +homepage:
  5 +
  6 +environment:
  7 + sdk: '>=3.4.0 <4.0.0'
  8 + flutter: '>=3.3.0'
  9 +
  10 +dependencies:
  11 + flutter:
  12 + sdk: flutter
  13 + plugin_platform_interface: ^2.0.2
  14 +
  15 +dev_dependencies:
  16 + flutter_test:
  17 + sdk: flutter
  18 + flutter_lints: ^3.0.0
  19 +
  20 +# For information on the generic Dart part of this file, see the
  21 +# following page: https://dart.dev/tools/pub/pubspec
  22 +
  23 +# The following section is specific to Flutter packages.
  24 +flutter:
  25 + # This section identifies this Flutter project as a plugin project.
  26 + # The 'pluginClass' specifies the class (in Java, Kotlin, Swift, Objective-C, etc.)
  27 + # which should be registered in the plugin registry. This is required for
  28 + # using method channels.
  29 + # The Android 'package' specifies package in which the registered class is.
  30 + # This is required for using method channels on Android.
  31 + # The 'ffiPlugin' specifies that native code should be built and bundled.
  32 + # This is required for using `dart:ffi`.
  33 + # All these are used by the tooling to maintain consistency when
  34 + # adding or updating assets for this project.
  35 + plugin:
  36 + platforms:
  37 + android:
  38 + package: com.ewin.flutter_channel
  39 + pluginClass: FlutterChannelPlugin
  40 +
  41 + # To add assets to your plugin package, add an assets section, like this:
  42 + # assets:
  43 + # - images/a_dot_burr.jpeg
  44 + # - images/a_dot_ham.jpeg
  45 + #
  46 + # For details regarding assets in packages, see
  47 + # https://flutter.dev/assets-and-images/#from-packages
  48 + #
  49 + # An image asset can refer to one or more resolution-specific "variants", see
  50 + # https://flutter.dev/assets-and-images/#resolution-aware
  51 +
  52 + # To add custom fonts to your plugin package, add a fonts section here,
  53 + # in this "flutter" section. Each entry in this list should have a
  54 + # "family" key with the font family name, and a "fonts" key with a
  55 + # list giving the asset and other descriptors for the font. For
  56 + # example:
  57 + # fonts:
  58 + # - family: Schyler
  59 + # fonts:
  60 + # - asset: fonts/Schyler-Regular.ttf
  61 + # - asset: fonts/Schyler-Italic.ttf
  62 + # style: italic
  63 + # - family: Trajan Pro
  64 + # fonts:
  65 + # - asset: fonts/TrajanPro.ttf
  66 + # - asset: fonts/TrajanPro_Bold.ttf
  67 + # weight: 700
  68 + #
  69 + # For details regarding fonts in packages, see
  70 + # https://flutter.dev/custom-fonts/#from-packages
  1 +import 'package:flutter/services.dart';
  2 +import 'package:flutter_test/flutter_test.dart';
  3 +import 'package:flutter_channel/flutter_channel_method_channel.dart';
  4 +
  5 +void main() {
  6 + TestWidgetsFlutterBinding.ensureInitialized();
  7 +
  8 + MethodChannelFlutterChannel platform = MethodChannelFlutterChannel();
  9 + const MethodChannel channel = MethodChannel('flutter_channel');
  10 +
  11 + setUp(() {
  12 + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(
  13 + channel,
  14 + (MethodCall methodCall) async {
  15 + return '42';
  16 + },
  17 + );
  18 + });
  19 +
  20 + tearDown(() {
  21 + TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(channel, null);
  22 + });
  23 +
  24 + test('getChannel', () async {
  25 + expect(await platform.getChannel(), '42');
  26 + });
  27 +}
  1 +import 'package:flutter_test/flutter_test.dart';
  2 +import 'package:flutter_channel/flutter_channel.dart';
  3 +import 'package:flutter_channel/flutter_channel_platform_interface.dart';
  4 +import 'package:flutter_channel/flutter_channel_method_channel.dart';
  5 +import 'package:plugin_platform_interface/plugin_platform_interface.dart';
  6 +
  7 +class MockFlutterChannelPlatform
  8 + with MockPlatformInterfaceMixin
  9 + implements FlutterChannelPlatform {
  10 +
  11 + @override
  12 + Future<String?> getChannel() => Future.value('42');
  13 +}
  14 +
  15 +void main() {
  16 + final FlutterChannelPlatform initialPlatform = FlutterChannelPlatform.instance;
  17 +
  18 + test('$MethodChannelFlutterChannel is the default instance', () {
  19 + expect(initialPlatform, isInstanceOf<MethodChannelFlutterChannel>());
  20 + });
  21 +
  22 + test('getChannel', () async {
  23 + FlutterChannel flutterChannelPlugin = FlutterChannel();
  24 + MockFlutterChannelPlatform fakePlatform = MockFlutterChannelPlatform();
  25 + FlutterChannelPlatform.instance = fakePlatform;
  26 +
  27 + expect(await flutterChannelPlugin.getChannel(), '42');
  28 + });
  29 +}