0
0
Fluttermobile~10 mins

Permissions handling in Flutter - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to import the permissions package in Flutter.

Flutter
import '[1]';
Drag options to blanks, or click blank then click option'
Apackage:flutter/material.dart
Bpackage:flutter/widgets.dart
Cpackage:flutter/services.dart
Dpackage:permission_handler/permission_handler.dart
Attempts:
3 left
💡 Hint
Common Mistakes
Importing core Flutter packages instead of the permissions package.
Forgetting to add the permission_handler package to pubspec.yaml.
2fill in blank
medium

Complete the code to request camera permission using permission_handler.

Flutter
var status = await Permission.[1].request();
Drag options to blanks, or click blank then click option'
Alocation
Bcamera
Cstorage
Dmicrophone
Attempts:
3 left
💡 Hint
Common Mistakes
Requesting the wrong permission type.
Not awaiting the request call.
3fill in blank
hard

Fix the error in checking if permission is granted.

Flutter
if (await Permission.[1].isGranted) {
  print('Permission granted');
}
Drag options to blanks, or click blank then click option'
Acamera
Brequest
Cstatus
Dcheck
Attempts:
3 left
💡 Hint
Common Mistakes
Using method names like 'request' or 'check' instead of permission types.
Not awaiting the isGranted call.
4fill in blank
hard

Fill both blanks to check and request microphone permission if not granted.

Flutter
if (!await Permission.[1].[2]) {
  await Permission.microphone.request();
}
Drag options to blanks, or click blank then click option'
Amicrophone
BisDenied
CisGranted
DisRestricted
Attempts:
3 left
💡 Hint
Common Mistakes
Using 'isDenied' or 'isRestricted' instead of 'isGranted' for checking permission.
Checking a different permission than microphone.
5fill in blank
hard

Fill all three blanks to create a map of permissions and their statuses filtering only granted ones.

Flutter
var grantedPermissions = {
  [1]: [2] for [3] in permissions
  if ([2].isGranted)
};
Drag options to blanks, or click blank then click option'
Aperm
Bstatus
Dpermissions
Attempts:
3 left
💡 Hint
Common Mistakes
Mixing variable names or using the same name for different roles.
Not filtering permissions correctly.