getCenter method Null safety

Offset getCenter(
  1. Finder finder,
  2. {bool warnIfMissed = false,
  3. String callee = 'getCenter'}
)

Returns the point at the center of the given widget.

If warnIfMissed is true (the default is false), then the returned coordinate is checked to see if a hit test at the returned location would actually include the specified element in the HitTestResult, and if not, a warning is printed to the console.

The callee argument is used to identify the method that should be referenced in messages regarding warnIfMissed. It can be ignored unless this method is being called from another that is forwarding its own warnIfMissed parameter (see e.g. the implementation of tap).

Implementation

Offset getCenter(Finder finder, { bool warnIfMissed = false, String callee = 'getCenter' }) {
  return _getElementPoint(finder, (Size size) => size.center(Offset.zero), warnIfMissed: warnIfMissed, callee: callee);
}