-
-
Notifications
You must be signed in to change notification settings - Fork 903
Description
Please check the following before submitting a new issue.
- I have searched the existing issues.
- I have carefully read the documentation and verified I have added the required platform specific configuration.
Please select affected platform(s)
- Android
- iOS
- Windows
Steps to reproduce
First add the first 2 line before the runApp function in main()
then give permission and log the output, it says permissionStatus.granted
but when i call on
await Permission.calendarFullAccess.status
[ you can uncomment the commented part and check]
is says permissionStatus.denied
But when i close out the app and rebuild it on xcode or vscode again, then it says
permissionStatus.granted
it takes new rebuild to configure the permission, which is not good
Expected results
it should show the granted permission for all state after the permission is granted by the user. Not after the rebuild of the app again
Actual results
It says permission denied and
INVOKE_CHANNEL_METHOD_ERROR: PlatformException(401, The user has not allowed this application to modify their calendar(s), null, null)
for the first time and then it fixes itself after rebuilding the app again
Code sample
Code sample
await Permission.calendarWriteOnly.request();
await Permission.calendarFullAccess.request();
static Future<PermissionStatus> _calendarPermissions() async {
Map<Permission, PermissionStatus> permissionStatus = await [Permission.calendarWriteOnly].request();
log("--- : " + permissionStatus.toString());
return permissionStatus[Permission.calendarWriteOnly] ?? PermissionStatus.denied;
// PermissionStatus permission = await Permission.calendarWriteOnly.status;
// if (!permission.isGranted) {
// log(permission.toString());
// Map<Permission, PermissionStatus> permissionStatus = await [Permission.calendarWriteOnly].request();
// log("--- : " + permissionStatus.toString());
// return permissionStatus[Permission.calendarWriteOnly] ?? PermissionStatus.denied;
// } else {
// return permission;
// }
}
static Future<PermissionStatus> _calendarPermissions2() async {
Map<Permission, PermissionStatus> permissionStatus = await [Permission.calendarFullAccess].request();
log("--- : " + permissionStatus.toString());
return permissionStatus[Permission.calendarFullAccess] ?? PermissionStatus.denied;
// PermissionStatus permission = await Permission.calendarFullAccess.status;
// if (!permission.isGranted) {
// log(permission.toString());
// Map<Permission, PermissionStatus> permissionStatus = await [Permission.calendarFullAccess].request();
// log("--- : " + permissionStatus.toString());
// return permissionStatus[Permission.calendarFullAccess] ?? PermissionStatus.denied;
// } else {
// return permission;
// }
}
Future<bool> calendarPermissionsGranted() async {
PermissionStatus calendarPermissionsStatus = await _calendarPermissions();
log("break");
PermissionStatus calendarPermissionsStatus2 = await _calendarPermissions2();
// if (calendarPermissionsStatus2.isGranted) {
if (calendarPermissionsStatus.isGranted && calendarPermissionsStatus2.isGranted) {
log("yes");
return true;
} else {
log("no");
return false;
}
}
Screenshots or video
Screenshots or video demonstration
Version
11.1.0
Flutter Doctor output
Doctor output
flutter doctor -v
[✓] Flutter (Channel stable, 3.16.0, on macOS 14.0 23A344 darwin-x64, locale en-JP)
• Flutter version 3.16.0 on channel stable at /Users/emongenie/Downloads/Apps/flutter
• Upstream repository https://github.com/flutter/flutter.git
• Framework revision db7ef5bf9f (7 days ago), 2023-11-15 11:25:44 -0800
• Engine revision 74d16627b9
• Dart version 3.2.0
• DevTools version 2.28.2
[✓] Android toolchain - develop for Android devices (Android SDK version 34.0.0)
• Android SDK at /Users/emongenie/Library/Android/sdk
• Platform android-34, build-tools 34.0.0
• Java binary at: /Applications/Android Studio.app/Contents/jbr/Contents/Home/bin/java
• Java version OpenJDK Runtime Environment (build 17.0.6+0-17.0.6b829.9-10027231)
• All Android licenses accepted.
[✓] Xcode - develop for iOS and macOS (Xcode 15.0.1)
• Xcode at /Applications/Xcode.app/Contents/Developer
• Build 15A507
• CocoaPods version 1.14.2
[✓] Chrome - develop for the web
• Chrome at /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
[✓] Android Studio (version 2022.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 17.0.6+0-17.0.6b829.9-10027231)
[✓] VS Code (version 1.84.2)
• VS Code at /Applications/Visual Studio Code.app/Contents
• Flutter extension version 3.76.0
[✓] Connected device (3 available)
• iPhone 15 Pro Max (mobile) • 744BEB5C-7838-4731-8C65-3FFF26E3F994 • ios • com.apple.CoreSimulator.SimRuntime.iOS-17-0 (simulator)
• macOS (desktop) • macos • darwin-x64 • macOS 14.0 23A344 darwin-x64
• Chrome (web) • chrome • web-javascript • Google Chrome 119.0.6045.159
! Error: Browsing on the local area network for iPhone. Ensure the device is unlocked and attached with a cable or associated with the same local area network as this Mac.
The device must be opted into Developer Mode to connect wirelessly. (code -27)
[✓] Network resources
• All expected network resources are available.
• No issues found!