No implementation found for method getAll on channel dev.fluttercommunity.plus/package_info

1k Views Asked by At

I'm trying to debug a project for windows, and I'm having this problem: It runs and stops at Parse().initialize giving the error

[ERROR:flutter/lib/ui/ui_dart_state.cc(209)] Unhandled Exception: MissingPluginException(No implementation found for method getAll on channel dev.fluttercommunity.plus/package_info)
#0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:175:7)
<asynchronous suspension>
#1      MethodChannel.invokeMapMethod (package:flutter/src/services/platform_channel.dart:377:43)
<asynchronous suspension>
#2      MethodChannelPackageInfo.getAll (package:package_info_plus_platform_interface/method_channel_package_info.dart:13:17)
<asynchronous suspension>
#3      PackageInfo.fromPlatform (package:package_info_plus/package_info_plus.dart:36:26)
<asynchronous suspension>
#4      Parse.initialize (package:parse_server_sdk_flutter/parse_server_sdk.dart:67:39)
<asynchronous suspension>
#5      initializeParse (package:spa/main.dart:73:3)
<asynchronous suspension>
#6      main`enter code here` (package:spa/main.dart:27:3)
<asynchronous suspension>

I've tried everything, clean and pub get. When it runs for the web it works normally, it just gives an error when I go to run for windows

2

There are 2 best solutions below

1
On BEST ANSWER

I managed to solve the problem.

To solve the problem I had to add the package_info_plus_windows plugin

flutter pub add package_info_plus_windows

Then in the Parse method I added this

import 'package:package_info_plus_platform_interface/package_info_data.dart';

Future<void> initializeParse() async {
  const appId = 'xxxx';
  const clientKey = 'xxxxx';
  const serverURL = 'xxxx';
  const liveQueryUrl = 'xxxx';
  PackageInfoData packageInfoWindows = await PackageInfoWindows().getAll();

  await Parse().initialize(
    appId,
    serverURL,
    clientKey: clientKey,
    liveQueryUrl: liveQueryUrl,
    autoSendSessionId: true,
    debug: true,
    appName: packageInfoWindows.appName,
    appVersion: packageInfoWindows.version,
    appPackageName: packageInfoWindows.packageName,
  );
}
0
On

In my case PackageInfoData was not accessible so my solution was:

 var packageInfoWindows = await PackageInfoWindows().getAll();

  await Parse().initialize(
      keyApplicationId,
      keyParseServerUrl,
      clientKey: keyClientKey,
      autoSendSessionId: true,
    debug: true,
    appName: packageInfoWindows.appName,
    appVersion: packageInfoWindows.version,
    appPackageName: packageInfoWindows.packageName

  );