Baseflow / Baseflow/flutter-permission-handler
[Bug]: Callbacks like onGrantedCallback does not work as expected.
- Dominant language
- Dart
- Stars
- 2.2k
- Forks
- 970
- Avg merge
- 14h 22m
- Merged PRs (30d)
- 2
Description
### Please check the following before submitting a new issue.
- [X] I have searched the [existing issues](https://github.com/baseflow/flutter-permission-handler/issues).
- [X] I have carefully [read the documentation](https://github.com/Baseflow/flutter-permission-handler/blob/main/permission_handler/README.md) and verified I have added the required platform specific configuration.
### Please select affected platform(s)
- [X] Android
- [ ] iOS
- [ ] Windows
### Steps to reproduce
1. Use a callback `Permission.contacts.onGrantedCallback`
2. Grant permission for camera.
3. `Permission.contacts.onGrantedCallback` will be invoked.
### Expected results
When using `Permission.contacts.onGrantedCallback` we expect this callback to invoke only if we grant permission for contacts.
### Actual results
No mater what permission you add callback it will always gets invoked for every permission.
### Code sample
Code sample
```dart
Permission.contacts.onGrantedCallback(
() {
print('Contacts permission granted.');
},
);
```
### Screenshots or video
Screenshots or video demonstration
[Upload media here]
### Version
11.0.1
### Flutter Doctor output
Doctor output
```console
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 3.24.3, on macOS 14.6.1 23G93 darwin-arm64, locale en-NP)
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 16.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2024.2)
[✓] VS Code (version 1.95.3)
[✓] Connected device (4 available)
[✓] Network resources
• No issues found!
```
Contributor guide
Assessment
This issue has not been assessed yet.