of static method
- RenderObject? object
Returns the RenderAbstractViewport that most tightly encloses the given render object.
If the object does not have a RenderAbstractViewport as an ancestor, this function will assert in debug mode, and throw an exception in release mode.
See also:
- RenderAbstractViewport.maybeOf, which is similar to this method, but returns null if no RenderAbstractViewport ancestor is found.
Implementation
static RenderAbstractViewport of(RenderObject? object) {
final RenderAbstractViewport? viewport = maybeOf(object);
assert(() {
if (viewport == null) {
throw FlutterError(
'RenderAbstractViewport.of() was called with a render object that was '
'not a descendant of a RenderAbstractViewport.\n'
'No RenderAbstractViewport render object ancestor could be found starting '
'from the object that was passed to RenderAbstractViewport.of().\n'
'The render object where the viewport search started was:\n'
' $object',
);
}
return true;
}());
return viewport!;
}