flutter_device_type 0.1.0

  • README.md
  • CHANGELOG.md
  • Installing
  • Versions
  • new68

flutter_device_type

Determine the type of handheld device on Flutter. Like if the device is a Tablet or is iPhoneX. This is a port of react-native-device-detection.

Usage

//Get the physical device size
print( Device.size );
//Quick methods to access the physical device width and height
print("Device Width: ${Device.width}, Device Height: ${Device.height}");

//To get the actual screen size (Which is same as what MediaQuery gives)
print( Device.screenSize );
//Quick methods to access the screen width and height
print("Device Width: ${Device.screenWidth}, Device Height: ${Device.screenHeight}");

//Check if device is tablet
if( Device.get().isTablet ){
    //do something large
}

//Check if device is iphone x
if( Device.get().isIphoneX ){
    //Do some notch business
}

//Other utility methods
print( Device.get().isPhone );
print( Device.get().isAndroid );
print( Device.get().isIos );

//So to check for iPad for instance
if( Device.get().isIos && Device.get().isTablet ){
    //make the font larger :)
}

Device.get() will return only one instance so not need to save it except for brevity

[0.1.0] - 24-12-2018

  • Determine if device is a Table or Phone, if device is iOS or Android and if device if iPhoneX as well as get device's physical and screen dimensions

Use this package as a library

1. Depend on it

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


dependencies:
  flutter_device_type: ^0.1.0

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_type/flutter_device_type.dart';
  
Version Uploaded Documentation Archive
0.1.0 Dec 24, 2018 Go to the documentation of flutter_device_type 0.1.0 Download flutter_device_type 0.1.0 archive
Popularity:
Describes how popular the package is relative to other packages. [more]
40
Health:
Code health derived from static analysis. [more]
99
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
90
Overall:
Weighted score of the above. [more]
68
Learn more about scoring.

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

  • Dart: 2.1.0
  • pana: 0.12.10
  • Flutter: 1.1.7

Platforms

Detected platforms: Flutter

References Flutter, and has no conflicting libraries.

Health issues and suggestions

Document public APIs. (-1 points)

16 out of 16 API elements (library, class, field or method) have no adequate dartdoc content. Good documentation improves code readability and discoverability through search.

Format lib/flutter_device_type.dart.

Run flutter format to format lib/flutter_device_type.dart.

Maintenance suggestions

Maintain an example. (-10 points)

Create a short demo in the example/ directory to show how to use this package. Common file name patterns include: main.dart, example.dart or you could also use flutter_device_type.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0-dev.68.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