Baking navmesh on procedural terrain at runtime

Hello, I am creating a game which generates procedural terrain, and I want my navmesh to bake after the terrain has been generated and trees has been spawned, but I can’t find how to do it in the new version of NavMesh. All the tutorials that do this use the old version of NavMesh and I can’t find any official documentation on how to do it.

Unity >= 2019.4

https://docs.unity3d.com/Packages/com.unity.ai.navigation@2.0/manual/

using Unity.AI.Navigation;

[SerializeField] NavMeshSurface _navMeshSurface;

void OnEnable ()
{
    _navMeshSurface.BuildNavMesh();
}