web_browser_detect
2.3.1, released 4 weeks ago by tomas-chyly.com
Detect which browser and version is in use on Flutter Web.
What it does
Allows Flutter Web applications to detect the current browser name and version using the user agent string. It provides safe alternative methods for non-web platforms as well as a way to parse custom user agent strings.
AI-written summary of version 2.3.1, based on the package's README and metadata. Report an inaccuracy
Use it when
- You need to conditionally adjust web application behavior based on the user's browser.
- You need to log or display browser information in a Flutter web application.
Skip it when
- You have other, more reliable ways to handle platform or feature detection (like feature testing), as user agent detection is never completely reliable.
- Your application primarily targets non-web platforms.
Strengths
- Supports detection via `Browser.detectOrNull()` for cross-platform safety.
- Supports custom user agent parsing via `Browser.detectFrom()`.
Weaknesses
- Browser detection using UserAgent strings is never completely reliable.
- Does not support all current or past browsers out of the box.
Setup
- Kind
- Flutter widgets
- Effort
- Low
- Code generation
- No
- Direct dependencies
- 1
No special native setup required.
import 'package:web_browser_detect/web_browser_detect.dart';
void main() {
final browser = Browser.detectOrNull();
print('${browser?.browser ?? \'Wrong platform\'} ${browser?.version ?? \'Wrong platform\'}');
}Alternatives
Packages that do the same job and could replace web_browser_detect.
- shake_gesture
Detect shake gestures in Flutter apps on Android and iOS.
84Compare - connectivity_wrapper
Provides network-aware widgets and connectivity feedback for Flutter applications.
83Compare - platform_detect
Detects browser and OS types and versions in Dart web apps.
71Compare - root_checker_plus
Flutter plugin for Android root detection and iOS jailbreak detection.
67Compare
Works with
Packages commonly used together with web_browser_detect: ones it builds on, ones built on it, and its own family.