my_device_info_plus 0.0.6 copy "my_device_info_plus: ^0.0.6" to clipboard
my_device_info_plus: ^0.0.6 copied to clipboard

Plugin to get all device informations like model, platform, manufacturer, os version etc.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'dart:async';
import 'package:my_device_info_plus/my_device_info_plus.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> {
  String? _platform = "unknown";
  String? _model = "unknown";
  String? _manufacturer = "unknown";
  String? _os_version = "unknown";
  String? _sdk_version = "unknown";

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

  Future<dynamic> getDeviceInfo() async {
    var result = await MyDeviceInfoPlus.getDeviceInfo();
    setState(() {
      print(result);
      _model = result['model'];
      _manufacturer = result['manufacturer'];
      _os_version = result['os_version'];
      _sdk_version = result['sdk_version'];
      _platform = result['platform'];
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
          appBar: AppBar(
            title: const Text('Plugin example app'),
          ),
          body: Container(
            alignment: Alignment.center,
            child: Column(
              mainAxisAlignment: MainAxisAlignment.center,
              crossAxisAlignment: CrossAxisAlignment.center,
              children: <Widget>[
                Text('Model: $_model\n'),
                Text('Manufacturer: $_manufacturer\n'),
                Text('Os_version: $_os_version\n'),
                Text('Sdk_version: $_sdk_version\n'),
                Text('Platform: $_platform\n'),
              ],
            ),
          )),
    );
  }
}
4
likes
160
points
24
downloads

Publisher

unverified uploader

Weekly Downloads

Plugin to get all device informations like model, platform, manufacturer, os version etc.

Homepage

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on my_device_info_plus