Skip to content

Commit

Permalink
added await for taking the response first
Browse files Browse the repository at this point in the history
  • Loading branch information
Shubham04Jha committed Nov 5, 2024
1 parent 26ed818 commit d103e46
Showing 1 changed file with 5 additions and 11 deletions.
16 changes: 5 additions & 11 deletions lib/app/utils/permissions/permissions_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -6,19 +6,13 @@ import 'package:taskwarrior/app/utils/constants/permissions.dart';
class PermissionsManager {
static Future<void> requestAllPermissions() async {
try {
final results = await Future.wait(
permissions.map((permission) => _requestPermission(permission)));

for (var i = 0; i < results.length; i++) {
final permission = permissions[i];
final status = results[i];

for (var permission in permissions) {
final status = await _requestPermission(permission);

if (status) {
print(
"Permission '${permission.toString().split('.').last}' granted.");
print("Permission '${permission.toString().split('.').last}' granted.");
} else {
print(
"Permission '${permission.toString().split('.').last}' denied.");
print("Permission '${permission.toString().split('.').last}' denied.");
}
}
} catch (e) {
Expand Down

0 comments on commit d103e46

Please sign in to comment.