Skip to main content

BoxConstraintsExtension

Trait BoxConstraintsExtension 

Source
pub trait BoxConstraintsExtension: Any {
    // Required methods
    fn as_any(&self) -> &dyn Any;
    fn eq_extension(&self, other: &dyn BoxConstraintsExtension) -> bool;
}
Expand description

What a subclass of BoxConstraints adds to its value.

Flutter’s scaffold lays out its body and its bottom sheet with private subclasses (_BodyBoxConstraints, _BottomSheetBoxConstraints) that a LayoutBuilder below recognises with an as cast. Here BoxConstraints is a plain Copy value; a subclass is an extension that an AnyBoxConstraints carries beside the value the subclass constructor passed to super, as AnyColor carries a Color subclass.

Required Methods§

Source

fn as_any(&self) -> &dyn Any

The extension as Any, for Dart’s is checks (AnyBoxConstraints::extension).

Source

fn eq_extension(&self, other: &dyn BoxConstraintsExtension) -> 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 BoxConstraints.==’s runtimeType check makes it.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§