pub trait ColorExtension: Any + Debug {
// Required methods
fn as_any(&self) -> &(dyn Any + 'static);
fn eq_extension(&self, other: &(dyn ColorExtension + 'static)) -> bool;
}Expand description
What a subclass of Color adds to its value.
Flutter’s CupertinoDynamicColor, WidgetStateColor, and ColorSwatch extend Color
and travel wherever a Color is stored, to be recognised later by an is check
(CupertinoDynamicColor.resolve, WidgetStateProperty.resolveAs). Here the engine’s
Color is a plain value; a subclass is an extension that an AnyColor carries beside
the value the subclass constructor passed to super.
Required Methods§
Sourcefn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
The extension as Any, for Dart’s is checks (AnyColor::extension).
Sourcefn eq_extension(&self, other: &(dyn ColorExtension + 'static)) -> bool
fn eq_extension(&self, other: &(dyn ColorExtension + 'static)) -> bool
Dart’s == override on the subclass, called once the values compared equal. other
is the same runtime type when it downcasts; any other type is unequal, as Dart’s
runtimeType check makes it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".