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

[Bug]: Callbacks like onGrantedCallback does not work as expected. #1414

Open
3 of 5 tasks
ebsangam opened this issue Dec 9, 2024 · 2 comments
Open
3 of 5 tasks

[Bug]: Callbacks like onGrantedCallback does not work as expected. #1414

ebsangam opened this issue Dec 9, 2024 · 2 comments
Assignees

Comments

@ebsangam
Copy link

ebsangam commented Dec 9, 2024

Please check the following before submitting a new issue.

Please select affected platform(s)

  • 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
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
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!
@TimHoogstrate
Copy link
Contributor

Dear @ebsangam,

Can you elaborate a bit on the subject? Are you testing this in iOS or Android? And what version of OS?

Kind regards,

@TimHoogstrate TimHoogstrate self-assigned this Dec 11, 2024
@TimHoogstrate TimHoogstrate added the status: needs more info We need more information before we can continue work on this issue. label Dec 11, 2024
@ebsangam
Copy link
Author

I was testing on Android emulator SDK 34. I wanted to listen to contacts permission status change (on granted to be specific). So I used Permission.contacts.onGrantedCallback. But the callback gets invoked when I grant camera permission or microphone permission. Basically Permission.contacts.onGrantedCallback is not only listening to contacts permission updated but for every permission updates. Thanks.

@github-actions github-actions bot removed the status: needs more info We need more information before we can continue work on this issue. label Dec 11, 2024
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

2 participants