Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unhandled Exception: MissingPluginException(requestPermissions) #151

Open
RubenGarcia opened this issue Sep 4, 2023 · 4 comments
Open

Comments

@RubenGarcia
Copy link

RubenGarcia commented Sep 4, 2023

FlutterBlePeripheral flutterBlePeripheral = FlutterBlePeripheral();
BluetoothPeripheralState peripheralPermission = await flutterBlePeripheral.requestPermission();

throws this, although the permission is granted. Please investigate.

E/flutter ( 2983): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: MissingPluginException(No implementation found for method requestPermissions on channel dev.steenbakker.flutter_ble_peripheral/ble_state)
E/flutter ( 2983): #0      MethodChannel._invokeMethod (package:flutter/src/services/platform_channel.dart:308:7)
E/flutter ( 2983): <asynchronous suspension>
E/flutter ( 2983): #1      FlutterBlePeripheral.requestPermission (package:flutter_ble_peripheral/src/flutter_ble_peripheral.dart:135:9)
E/flutter ( 2983): <asynchronous suspension>

Android 12 (Pixel 3).

  flutter_ble_peripheral:
    dependency: "direct main"
    description:
      name: flutter_ble_peripheral
      sha256: aab19e5268f90237ab02cd084844596c37f76285f93759709742bab5627a76ac
      url: "https://pub.dev"
    source: hosted
    version: "1.2.1"

I followed the instructions on
https://pub.dev/packages/flutter_ble_peripheral/install
but cloning your repository, the example app works.
Please add any additional configuration to
https://pub.dev/packages/flutter_ble_peripheral/install

@RubenGarcia
Copy link
Author

Following
https://stackoverflow.com/questions/71646547/unhandled-exception-missingpluginexceptionno-implementation-found-for-method-f
did not solve the issue.
Clicking on stop and play also did not solve the issue.

@RubenGarcia
Copy link
Author

Another comment.
https://pub.dev/packages/flutter_ble_peripheral/example
uses always
await FlutterBlePeripheral().XXX
and does not save the result of FlutterBlePeripheral() into a variable for later use.
Is saving it into a variable forbidden?

@RubenGarcia
Copy link
Author

Changing the code to use FlutterBlePeripheral() everywhere did not change behaviour.

@RubenGarcia
Copy link
Author

Workaround: use
import 'package:permission_handler/permission_handler.dart';
to request the permissions explicitly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant