Can.builder constructor

const Can.builder({
  1. Key? key,
  2. required String I,
  3. required String a,
  4. required Widget abilityBuilder(
    1. BuildContext context,
    2. bool hasPermission
    )?,
  5. bool not = false,
})

Creates a Can widget using a builder function to dynamically generate the widget based on permissions.

  • I represents the action being checked.
  • a represents the subject being checked.
  • abilityBuilder is called with the permission result (true if allowed, false otherwise).
  • If not is true, the logic is reversed.

Implementation

const Can.builder({
  Key? key,
  required this.I,
  required this.a,
  required this.abilityBuilder,
  this.not = false,
})  : child = null,
      fallback = null,
      super(key: key);