File tree 5 files changed +13
-10
lines changed
5 files changed +13
-10
lines changed Original file line number Diff line number Diff line change @@ -34,31 +34,31 @@ dependencies:
34
34
` ` ` dart
35
35
import 'package:permission_handler/permission_handler.dart';
36
36
37
- Map<PermissionGroup, PermissionStatus> permissions = await PermissionHandler() .requestPermissions(PermissionGroup.Contacts );
37
+ Map<PermissionGroup, PermissionStatus> permissions = await PermissionHandler.requestPermissions([ PermissionGroup.contacts] );
38
38
```
39
39
40
40
### Checking permission
41
41
42
42
``` dart
43
43
import 'package:permission_handler/permission_handler.dart';
44
44
45
- PermissionStatus permission = await PermissionHandler() .checkPermissionStatus(PermissionGroup.Contacts );
45
+ PermissionStatus permission = await PermissionHandler.checkPermissionStatus(PermissionGroup.contacts );
46
46
```
47
47
48
48
### Open app settings
49
49
50
50
``` dart
51
51
import 'package:permission_handler/permission_handler.dart';
52
52
53
- bool isOpened = await PermissionHandler() .openAppSettings();
53
+ bool isOpened = await PermissionHandler.openAppSettings();
54
54
```
55
55
56
56
### Show a rationale for requesting permission (Android only)
57
57
58
58
``` dart
59
59
import 'package:permission_handler/permission_handler.dart';
60
60
61
- bool isShown = await PermissionHandler() .shouldShowRequestPermissionRationale(PermissionGroup.Contacts );
61
+ bool isShown = await PermissionHandler.shouldShowRequestPermissionRationale(PermissionGroup.contacts );
62
62
```
63
63
64
64
This will always return ` false ` on iOS.
Original file line number Diff line number Diff line change 1
1
import 'dart:io' ;
2
2
3
3
import 'package:flutter/material.dart' ;
4
- import 'package:permission_handler/permission_enums.dart' ;
5
4
import 'package:permission_handler/permission_handler.dart' ;
6
5
7
6
void main () => runApp (new MyApp ());
Original file line number Diff line number Diff line change
1
+ part of permission_handler;
2
+
1
3
/// Defines the state of a permission group
2
4
enum PermissionStatus {
3
5
/// Permission to access the requested feature is denied by the user.
Original file line number Diff line number Diff line change
1
+ library permission_handler;
2
+
1
3
import 'dart:async' ;
4
+ import 'dart:convert' ;
2
5
import 'dart:io' ;
3
6
4
7
import 'package:flutter/services.dart' ;
5
- import 'package:permission_handler/permission_enums.dart' ;
6
- import 'package:permission_handler/utils/codec.dart' ;
8
+
9
+ part 'package:permission_handler/permission_enums.dart' ;
10
+ part 'package:permission_handler/utils/codec.dart' ;
7
11
8
12
/// Provides a cross-platform (iOS, Android) API to request and check permissions.
9
13
class PermissionHandler {
Original file line number Diff line number Diff line change 1
- import 'dart:convert' ;
2
-
3
- import 'package:permission_handler/permission_enums.dart' ;
1
+ part of permission_handler;
4
2
5
3
class Codec {
6
4
static PermissionStatus decodePermissionStatus (dynamic value) {
You can’t perform that action at this time.
0 commit comments