CapabilityGuard class
Guards against using unsupported platform features.
Create one per controller to track warned features:
final guard = CapabilityGuard(capabilities);
// In a method that uses blur:
guard.require(
capabilities.blur,
'Blur effect',
'Using solid background color as fallback.',
);
Constructors
- CapabilityGuard(Capabilities capabilities, {UnsupportedBehavior behavior = UnsupportedBehavior.warnOnce})
Properties
- behavior → UnsupportedBehavior
-
How to handle unsupported features.
final
- capabilities → Capabilities
-
The platform capabilities to check against.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
clearWarnings(
) → void - Clear warned features (for testing).
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
require(
bool supported, String feature, [String? fallback]) → bool - Check if a feature is supported and handle if not.
-
requireBlur(
[String? fallback]) → bool - Check blur support.
-
requireContentSizing(
[String? fallback]) → bool - Check content sizing support.
-
requireGlassEffect(
[String? fallback]) → bool - Check glass effect support.
-
requireGlobalHotkeys(
[String? fallback]) → bool - Check global hotkeys support.
-
requireMultiMonitor(
[String? fallback]) → bool - Check multi-monitor support.
-
requireTransform(
[String? fallback]) → bool - Check transform support.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited