device_info_details_plugin 0.0.2 copy "device_info_details_plugin: ^0.0.2" to clipboard
device_info_details_plugin: ^0.0.2 copied to clipboard

Flutter plugin to share detailed device information involves collecting data from both Android and iOS platforms

example/lib/main.dart

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

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

class MyApp extends StatefulWidget {
  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  Map<String, String> _deviceInfo = {};

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

  Future<void> _getDeviceInfo() async {
    Map<String, String> deviceInfo;
    try {
      deviceInfo = await DeviceInfoPlugin.getDeviceInfo();
    } catch (e) {
      deviceInfo = {'Error': 'Failed to get device info'};
    }

    if (!mounted) return;

    setState(() {
      _deviceInfo = deviceInfo;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Device Info Plugin Example'),
        ),
        body: Center(
          child: Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: _deviceInfo.entries.map((entry) {
              return Text('${entry.key}: ${entry.value}');
            }).toList(),
          ),
        ),
      ),
    );
  }
}
2
likes
150
points
25
downloads

Publisher

unverified uploader

Weekly Downloads

Flutter plugin to share detailed device information involves collecting data from both Android and iOS platforms

Homepage

Documentation

API reference

License

MIT (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on device_info_details_plugin