device_user_agent 0.1.2 copy "device_user_agent: ^0.1.2" to clipboard
device_user_agent: ^0.1.2 copied to clipboard

Flutter plugin to build user agent containing device information.

example/lib/main.dart

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

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Device User Agent',
      theme: ThemeData(
        colorScheme: ColorScheme.fromSeed(seedColor: Colors.deepPurple),
        useMaterial3: true,
      ),
      home: const HomePage(),
    );
  }
}

class HomePage extends StatelessWidget {
  const HomePage({super.key});

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('Device User Agent'),
      ),
      body: Center(
        child: Padding(
          padding: const EdgeInsets.all(16),
          child: FutureBuilder(
            future: DeviceUserAgent.instance.build(),
            builder: (context, snapshot) {
              if (snapshot.hasData) {
                return Card(
                  child: Padding(
                    padding: const EdgeInsets.all(8),
                    child: Text(snapshot.data ?? ''),
                  ),
                );
              } else if (snapshot.hasError) {
                return Text('Error: ${snapshot.error}');
              } else {
                return const CircularProgressIndicator();
              }
            },
          ),
        ),
      ),
    );
  }
}
copied to clipboard
3
likes
150
points
1.76k
downloads

Publisher

verified publisheracmesoftware.com

Weekly Downloads

2024.09.26 - 2025.04.10

Flutter plugin to build user agent containing device information.

Homepage
Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

device_info_plus, flutter, package_info_plus, web

More

Packages that depend on device_user_agent