flutter_device_information 0.1.3

  • README.md
  • CHANGELOG.md
  • Example
  • Installing
  • Versions
  • 55

flutter_device_information #

Introduction #

A plugin for using Android devices information in Flutter. You can use it to get Android release version,Android API version,board name,brand name,model name, cpu ABI etc.

Features #

Supports in Android now.

  • get release version.
  • get API version(SDKINT).
  • get board name.
  • get brand name.
  • get model name.
  • get CPUABI.

Getting Started #

For help getting started with Flutter, view the online Flutter Documentation.

1.In your flutter project add the dependency: #

dependencies:
  ...
  flutter_devices_information: any

2.import flutter_device_information.dart

import 'package:flutter_device_information/flutter_device_information.dart';
///
Your code here.
///

3.Use methods in library. #

Future<void> getInfos() async {
  String platformVersion = await FlutterDeviceInformation.platformVersion;
  String sdkInt = await FlutterDeviceInformation.sdkInt;
  String board = await FlutterDeviceInformation.board;
  String brand = await FlutterDeviceInformation.brand;
  String model = await FlutterDeviceInformation.model;
  String cpuABI = await FlutterDeviceInformation.cpuAbi;
}

Examples #

Here is Examples. You can find the sample codes and the screenshot in it.

More documentations #

For help getting started with the library, view the online documentation.

Request issues #

Please request bugs at the issue tracker.

License #

More infomation here: License.

0.1.3 #

use new Flutter Plugin and refix some docs.

0.1.2 #

  • Refix some erors.

0.1.1 #

  • Refix the documentations.

0.1.0 #

  • Refix the documentations and modify some bugs.Add more samples.

0.0.1 #

  • First commit.The library provided how to get android devices informations.

example/README.md

flutter_device_information_example #

Introduce #

Demonstrates how to use the flutter_device_information plugin.

Getting Started #

For help getting started with Flutter, view the online Flutter Documentation.

Sample Codes #

import 'dart:async';

import 'package:flutter/material.dart';
import 'package:flutter/services.dart';
import 'package:flutter_device_information/flutter_device_information.dart';

void main() => runApp(MyApp());

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

class _MyAppState extends State<MyApp> {
  String _platformVersion = 'Unknown';
  String _sdkInt = 'Unknown';
  String _board = 'Unknown';
  String _brand = 'Unknown';
  String _model = 'Unknown';
  String _cpuAbi = 'Unknown';

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

  // Platform messages are asynchronous, so we initialize in an async method.
  Future<void> initPlatformState() async {
    String platformVersion;
    String sdkInt;
    String board;
    String brand;
    String model;
    String cpuAbi;

    // Platform messages may fail, so we use a try/catch PlatformException.
    try {
      platformVersion = await FlutterDeviceInformation.platformVersion;
      sdkInt = await FlutterDeviceInformation.sdkInt;
      board = await FlutterDeviceInformation.board;
      brand = await FlutterDeviceInformation.brand;
      model = await FlutterDeviceInformation.model;
      cpuAbi = await FlutterDeviceInformation.cpuAbi;
    } on PlatformException {
      platformVersion = 'Failed to get platform version.';
      sdkInt = 'Failed to get sdkInt version.';
      board = 'Failed to get preViewSdkInt version.';
      brand = 'Failed to get platform version.';
      model = 'Failed to get codeName.';
      cpuAbi = 'Failed to get CPUABI.';
    }

    // If the widget was removed from the tree while the asynchronous platform
    // message was in flight, we want to discard the reply rather than calling
    // setState to update our non-existent appearance.
    if (!mounted) return;

    setState(() {
      _platformVersion = platformVersion;
      _sdkInt = sdkInt;
      _board = board;
      _brand = brand;
      _model = model;
      _cpuAbi = cpuAbi;
    });
  }

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          //          child: Text('Running on: $_platformVersion\n'),
          child: new Column(
            mainAxisAlignment: MainAxisAlignment.center,
            children: <Widget>[
              Text('${_platformVersion}'),
              Text('${_sdkInt}'),
              Text('${_board}'),
              Text('${_brand}'),
              Text('${_model}'),
              Text('${_cpuAbi}'),
            ],
          ),
        ),
      ),
    );
  }
}

Screenshot #

截图

Use this package as a library

1. Depend on it

Add this to your package's pubspec.yaml file:


dependencies:
  flutter_device_information: ^0.1.3

2. Install it

You can install packages from the command line:

with Flutter:


$ flutter packages get

Alternatively, your editor might support flutter packages get. Check the docs for your editor to learn more.

3. Import it

Now in your Dart code, you can use:


import 'package:flutter_device_information/flutter_device_information.dart';
  
Version Uploaded Documentation Archive
0.1.3 Feb 22, 2019 Go to the documentation of flutter_device_information 0.1.3 Download flutter_device_information 0.1.3 archive
0.1.2 Jan 31, 2019 Go to the documentation of flutter_device_information 0.1.2 Download flutter_device_information 0.1.2 archive
0.1.1 Jan 31, 2019 Go to the documentation of flutter_device_information 0.1.1 Download flutter_device_information 0.1.1 archive
0.1.0 Jan 31, 2019 Go to the documentation of flutter_device_information 0.1.0 Download flutter_device_information 0.1.0 archive
0.0.1 Jan 31, 2019 Go to the documentation of flutter_device_information 0.0.1 Download flutter_device_information 0.0.1 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
10
Health:
Code health derived from static analysis. [more]
100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
100
Overall:
Weighted score of the above. [more]
55
Learn more about scoring.

We analyzed this package on Apr 25, 2019, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.2.0
  • pana: 0.12.14
  • Flutter: 1.4.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.1.0 <3.0.0
flutter 0.0.0
Transitive dependencies
collection 1.14.11
meta 1.1.6 1.1.7
sky_engine 0.0.99
typed_data 1.1.6
vector_math 2.0.8
Dev dependencies
flutter_test