Instead of catching the exception, you can pass in the desired behavior. Something like:

    tabToReplace = tabs.firstWhere((t) => !t.persisted, orElse: () => null);