PermissionHandler.merge constructor

PermissionHandler.merge(
  1. List<PermissionHandler> handlers
)

Implementation

factory PermissionHandler.merge(List<PermissionHandler> handlers) {
  return PermissionHandler.custom(
      callback: (a) async {
        var checkers = <Future<bool>>[];
        for (var handler in handlers) {
          checkers.add(Future.value(handler.checker(a)));
        }
        return (await Future.wait(checkers))
            .where((element) => element)
            .isNotEmpty;
      },
      beforeNeed: handlers.where((element) => element.beforeNeed).isNotEmpty);
}