device 0.1.0

  • Readme
  • Changelog
  • Example
  • Installing
  • new57

Device #

Build Status

Data structure for a device.

   // data properties
   int id,
   String uniqueId,
   int groupId,
   String name,
   GeoPoint position,
   double batteryLevel,
   GeoDataFrame df,
   Map<String, dynamic> properties,
   // state properties
   bool isVisible = true,
   bool isDisabled = false,
   Duration keepAlive = const Duration(minutes: 1),
   Duration sleepingTimeout = const Duration(minutes: 10),
   bool isFollowed = false,
   bool isTraced = false

Position #

The device position is a GeoPoint

   final GeoPoint lastPosition = device.position;
   final DateTime lastPositionDate = device.lastPositionDate;

Speed #

   final double speed = device.speed;
   /// The speed of the device

Network status #

   final DeviceNetworkStatus networkStatus = device.networkStatus;
   /// One of [DeviceNetworkStatus.online], [DeviceNetworkStatus.sleeping],
   /// [DeviceNetworkStatus.offline] or [DeviceNetworkStatus.unknown]

   final bool isConnected = device.isAlive;
   /// Has the device been seen on the network before [keepAlive] timeout

   final bool hasJustDisconnected = device.isSleeping;
   /// Has the device been seen on the network before [sleepingTimeout] timeout
  
  final bool isDisconnected = device.isOffline;
  /// Last time the device was seen on the network is before [sleepingTimeout] timeout
  
  final bool hasNeverBeenSeen = device.isUnknown;
  /// The device has never been seen on the network

Info #

   final device.describe();
   /// Print device info

Changelog #

0.1.0 #

Initial

example/main.dart

import 'package:device/device.dart';
import 'package:geopoint/geopoint.dart';

void main() {
  final device = Device(
      id: 1,
      name: "device1",
      position: GeoPoint(latitude: 0.0, longitude: 0.0, speed: 30));
  print(device.speed);
}

Use this package as a library

1. Depend on it

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


dependencies:
  device: ^0.1.0

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter pub get

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

3. Import it

Now in your Dart code, you can use:


import 'package:device/device.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
15
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]
57
Learn more about scoring.

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

  • Dart: 2.6.1
  • pana: 0.12.21

Platforms

Detected platforms: Flutter, other

Primary library: package:device/device.dart with components: io, isolate.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.4.0 <3.0.0
extra_pedantic ^1.1.1+3 1.1.1+3
geodf ^0.1.0 0.1.0
geopoint ^0.7.0 0.7.0
meta ^1.1.6 1.1.8
pedantic ^1.7.0 1.8.0+1
Transitive dependencies
ansicolor 1.0.2
console_log_handler 1.1.6
df 0.1.0
geodesy 0.3.2
geojson 0.7.3
injector 1.0.8
intl 0.16.0
iso 0.2.3
jiffy 2.1.2
latlong 0.6.1
logging 0.11.3+2
matcher 0.12.6
ml_linalg 12.7.1
path 1.6.4
quiver 2.1.2+1
rxdart 0.22.6 0.23.0-dev.2
slugify2 0.2.1
stack_trace 1.9.3
validate 1.7.0
xrange 0.0.8