toOffset method
Implementation
Offset? toOffset({
void Function(Object error, StackTrace stackTrace)? onError,
}) {
try {
final renderBox = currentContext?.findRenderObject() as RenderBox?;
if (renderBox == null) return null;
Offset offset = renderBox
.localToGlobal(Offset.zero)
.translate(renderBox.size.width / 2, renderBox.size.height / 2);
return offset;
} catch (e, stack) {
if (onError != null) {
onError(e, stack);
}
return null;
}
}