Skip to content
pubscout

web_multiple_tab_detector

0.4.0, released 4 months ago by famedly.com

Detects how many browser tabs your Flutter web app is running in.

WASM-readyCopyleft license
$ flutter pub add web_multiple_tab_detector
Source repository

What it does

This package allows you to track and detect the number of browser tabs currently running your Flutter web application. It provides an asynchronous check to determine if the app is running in a single tab or multiple tabs. If not running in a web browser, it always returns 0.

AI-written summary of version 0.4.0, based on the package's README and metadata. Report an inaccuracy

Use it when

  • You want to restrict your Flutter web app to only run in a single browser tab
  • You need to detect multiple concurrent browser sessions of your app

Skip it when

  • Your app does not target the web platform
  • You need state synchronization across tabs rather than just a tab count detector

Strengths

  • Simple registration and checking API
  • WASM compatible

Weaknesses

  • Returns 0 when not running in a web browser
  • Limited to counting browser tabs without built-in multi-tab state syncing features

Setup

Kind
Pure Dart
Effort
Low
Code generation
No
Direct dependencies
1

Call WebMultipleTabDetector.register() before checking tab status.

import 'package:web_multiple_tab_detector/web_multiple_tab_detector.dart';

void main() async {
  WebMultipleTabDetector.register();

  if (await WebMultipleTabDetector.isSingleTab()) {
    // only one open tab allowed!
  } else {
    // launch app normally
  }
}

Alternatives

Packages that do the same job and could replace web_multiple_tab_detector.

Works with

Packages commonly used together with web_multiple_tab_detector: ones it builds on, ones built on it, and its own family.