Very cool. Nav 2.0 should have been replaced by such a solution as soon as the sealed classes were introduced to dart.