rx_permissions 1.1.0 copy "rx_permissions: ^1.1.0" to clipboard
rx_permissions: ^1.1.0 copied to clipboard

This package provides a reactive cross-platform (iOS, Android) API to request and check permissions for the permission_handler package.

Pub

This package provides a reactive cross-platform (iOS, Android) API to request and check permissions for the permission_handler package.

How to use #

Request a subject for the permission you are interested in.

    List<Permission> requiredPermission = [Permission.camera, Permission.microphone];
    final subject = rx_permissions.permissions(requiredPermission);

Once you have received the stream, you can observe it as usual and react to changes.


 subject.listen((permissionResults) => onPermissionUpdate(permissionResults));

 //...

 void onPermissionUpdate(List<Permission> result) async {
    List<PermissionResult> permissionResults = await Future.wait(result.map((i) async {
      final granted = await i.isGranted;
      final revoked = await i.isPermanentlyDenied;
      return PermissionResult(i, granted, revoked);
    }));
  }

 class PermissionResult {
   final Permission permission;
   final bool granted;
   final bool revoked;

   PermissionResult(this.permission, this.granted, this.revoked);
 }

Call the request()-method to request the required permissions

  rx_permissions.request(requiredPermission);
2
likes
130
pub points
17%
popularity

Publisher

unverified uploader

This package provides a reactive cross-platform (iOS, Android) API to request and check permissions for the permission_handler package.

Homepage
Repository (GitHub)
View/report issues

Documentation

API reference

License

Apache-2.0 (license)

Dependencies

flutter, permission_handler, rxdart

More

Packages that depend on rx_permissions