replacePop static method
Atomically replaces an existing overlay with a new one.
The overlay identified by id is removed (without animation) and
newContent is added in its place. If no overlay with id exists,
newContent is simply added.
Implementation
static void replacePop(String id, PopOverlayContent newContent) {
if (isActiveById(id)) {
// Remove old overlay immediately without animation
_controller.update<List<PopOverlayContent>>((state) {
state.removeWhere((element) {
if (element.id == id) {
element.dispose();
}
return element.id == id;
});
return state;
});
_invisibleController.update<List<String>>((state) {
state.remove(id);
return state;
});
}
addPop(newContent);
}