made preBuildContext closure optional