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

A plugin that enables you to retrieve the current platform (iOS, Android, Windows, ...)+ brower & more

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  num? version;
  dynamic? browser;

  @override
  void initState() {
    super.initState();

    AdvancedPlatform.browser().then((value) {
      setState(() {
        browser = value;
      });
    });

    AdvancedPlatform.version().then((value) {
      setState(() {
        version = value;
      });
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Text('Version $version Browser $browser'),
        ),
      ),
    );
  }
}
4
likes
120
pub points
25%
popularity

Publisher

verified publishergaspardmerten.dev

A plugin that enables you to retrieve the current platform (iOS, Android, Windows, ...)+ brower & more

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

flutter, flutter_web_plugins

More

Packages that depend on advanced_platform_detection