close method
Navigation.popUntil() (with predicate) shortcut .
Close as many routes as defined by times
id
is for when you are using nested navigation,
as explained in documentation
Implementation
void close(int times, [int? id]) {
if (times < 1) {
times = 1;
}
var count = 0;
var back = global(id).currentState?.popUntil((route) => count++ == times);
return back;
}