Kent1011 / client_information

A plugin to get basic information from the client of your Flutter application
https://pub.dev/packages/client_information
MIT License
6 stars 17 forks source link

Unhandled Exception: MissingPluginException(No implementation found for method getInformation on channel client_information) #9

Open mohitmarfatia-aibender opened 1 year ago

mohitmarfatia-aibender commented 1 year ago

I'm getting this error: E/flutter ( 9552): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method getInformation on channel client_information) E/flutter ( 9552): #0 MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:294:7) E/flutter ( 9552): <asynchronous suspension> E/flutter ( 9552): #1 ClientInformation.fetch (package:client_information/client_information.dart:37:17) E/flutter ( 9552): <asynchronous suspension>

Code:

void getInitialData() async {

  try {
      ClientInformation info = await ClientInformation.fetch();
    if (!mounted) return;
    setState(() {
      _clientInfo = info;
      isLoading = false;
    });
    } on PlatformException {
      print('Failed to get client information');
    }
}

 @override
  void initState() {
    getInitialData();
    super.initState();
  }

Flutter doctor -v:

[✓] Flutter (Channel stable, 3.3.10, on macOS 13.1 22C65 darwin-arm, locale en-IN)
    • Flutter version 3.3.10 on channel stable at /Users/abhishekchandaliya/Developer/sdk/flutter
    • Upstream repository https://github.com/flutter/flutter.git
    • Framework revision 135454af32 (2 months ago), 2022-12-15 07:36:55 -0800
    • Engine revision 3316dd8728
    • Dart version 2.18.6
    • DevTools version 2.15.0

[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
    • Android SDK at /Users/abhishekchandaliya/Library/Android/sdk
    • Platform android-33, build-tools 33.0.0
    • Java binary at: /Applications/Android Studio.app/Contents/jre/Contents/Home/bin/java
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)
    • All Android licenses accepted.

[✓] Xcode - develop for iOS and macOS (Xcode 14.0)
    • Xcode at /Applications/Xcode.app/Contents/Developer
    • Build 14A309
    • CocoaPods version 1.11.3

[✓] Chrome - develop for the web
    • Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome

[✓] Android Studio (version 2021.3)
    • Android Studio at /Applications/Android Studio.app/Contents
    • Flutter plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/9212-flutter
    • Dart plugin can be installed from:
      🔨 https://plugins.jetbrains.com/plugin/6351-dart
    • Java version OpenJDK Runtime Environment (build 11.0.13+0-b1751.21-8125866)

[✓] VS Code (version 1.75.1)
    • VS Code at /Applications/Visual Studio Code.app/Contents
    • Flutter extension can be installed from:
      🔨 https://marketplace.visualstudio.com/items?itemName=Dart-Code.flutter

[✓] Connected device (3 available)
    • sdk gphone64 arm64 (mobile) • emulator-5554 • android-arm64  • Android 12 (API 31) (emulator)
    • macOS (desktop)             • macos         • darwin-arm64   • macOS 13.1 22C65 darwin-arm
    • Chrome (web)                • chrome        • web-javascript • Google Chrome 110.0.5481.177

[✓] HTTP Host Availability
    • All required HTTP hosts are available

• No issues found!
Kent1011 commented 1 year ago

Based on the code snippet you provided and the information you gave, there should be no problem. Have you tried running the code directly in the "example/" directory?

garrettlove8 commented 1 year ago

I'm also running into this when using Flutter Web