removeTabById method

void removeTabById(
  1. String id
)

Implementation

void removeTabById(String id) {
  final i = tabs.indexWhere((e) => e.id == id);
  tabs.removeWhere((e) => e.id == id);
  if (currentTab == id) {
    currentTab = tabs.isEmpty
        ? null
        : tabs.length == i
            ? tabs.last.id
            : tabs[i].id;
  }
  notifyListeners();
}