afterFirstLayout static method

void afterFirstLayout(
  1. VoidCallback callback
)

DO THAT:

WidgetsBinding.instance.endOfFrame.then((_) => callback());

Implementation

static void afterFirstLayout(VoidCallback callback) {
  WidgetsBinding.instance.endOfFrame.then((_) => callback());
}