web_browser_detect 1.0.4 copy "web_browser_detect: ^1.0.4" to clipboard
web_browser_detect: ^1.0.4 copied to clipboard

outdated

Flutter Web browser detection package. This package allows you to detect which browser and its version is in use.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:web_browser_detect/web_browser_detect.dart';

void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    // final browser = Browser(); // throws exception if not on web platform

    final browser = Browser.detectOrNull(); // return null if not on web platform

    return MaterialApp(
      title: 'web_browser_detect Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: Material(
        child: Column(
          mainAxisSize: MainAxisSize.max,
          mainAxisAlignment: MainAxisAlignment.center,
          children: [
            Text('The browser is ${browser?.browser ?? 'Wrong platform'}'),
            Text('Browser version is ${browser?.version ?? 'Wrong platform'}'),
          ],
        ),
      ),
    );
  }
}
15
likes
0
pub points
94%
popularity

Publisher

verified publishertomas-chyly.com

Flutter Web browser detection package. This package allows you to detect which browser and its version is in use.

Homepage
Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter, universal_html

More

Packages that depend on web_browser_detect