tesla 0.2.0

Tesla for Dart Build Status

Control and monitor Tesla Products in Dart

Tesla.dart Changelog #

v0.2.0 #

  • Drop support for Dart v1.x.x
  • Add setSentryMode command, and support for isSentryMode getter.

v0.1.2 #

  • More reworking, cleans up code and minor improvements.

v0.0.4 #

  • Rework HTTP implementation to share code more.
  • Allow using BASE64-encoded passwords for the standard tool API.
  • Fix a bug with typing.

v0.0.3 #

  • Reorganize code to allow custom endpoints.
  • Allow injecting API tokens.
  • Rename OptionCode to VehicleOptionCode.
  • Basic support for the browser (requires an API proxy).

v0.0.2 #

  • Abstract API and cleanup.
  • Option code support.
  • Support for software updates.
  • Multi-platform support.

v0.0.1 #

  • Initial Version: No documentation.

example/tesla.dart

import 'dart:async';

import 'package:tesla/tool.dart';

Future main() async {
  var client = getTeslaClient();
  for (var vehicle in await client.listVehicles()) {
    print("Vehicle ${vehicle.displayName} is ${vehicle.state}");
  }
  client.close();
}

Use this package as a library

1. Depend on it

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


dependencies:
  tesla: ^0.2.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:tesla/tesla.dart';
  
Popularity:
Describes how popular the package is relative to other packages. [more]
17
Health:
Code health derived from static analysis. [more]
90
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80
Overall:
Weighted score of the above. [more]
52
Learn more about scoring.

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

  • Dart: 2.4.0
  • pana: 0.12.19

Platforms

Detected platforms: Flutter, web, other

No platform restriction found in primary library package:tesla/tesla.dart.

Health issues and suggestions

Document public APIs. (-0.95 points)

658 out of 659 API elements have no dartdoc comment.Providing good documentation for libraries, classes, functions, and other API elements improves code readability and helps developers find and use your API.

Fix lib/src/types/vehicle.dart. (-2.96 points)

Analysis of lib/src/types/vehicle.dart reported 6 hints, including:

line 64 col 35: Use = to separate a named parameter from its default value.

line 133 col 36: Use = to separate a named parameter from its default value.

line 191 col 36: Use = to separate a named parameter from its default value.

line 191 col 54: Use = to separate a named parameter from its default value.

line 219 col 40: Use = to separate a named parameter from its default value.

Fix lib/src/impl/common/http.dart. (-2.48 points)

Analysis of lib/src/impl/common/http.dart reported 5 hints:

line 143 col 21: Use = to separate a named parameter from its default value.

line 144 col 20: Use = to separate a named parameter from its default value.

line 151 col 21: Use = to separate a named parameter from its default value.

line 152 col 20: Use = to separate a named parameter from its default value.

line 158 col 23: Use = to separate a named parameter from its default value.

Fix bin/proxy.dart. (-1.49 points)

Analysis of bin/proxy.dart reported 3 hints:

line 80 col 7: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 84 col 7: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

line 113 col 7: Future results in async function bodies must be awaited or marked unawaited using package:pedantic.

Fix additional 5 files with analysis or formatting issues. (-2.50 points)

Additional issues in the following files:

  • bin/report.dart (1 hint)
  • bin/status.dart (1 hint)
  • bin/swupdate.dart (1 hint)
  • lib/src/impl/browser.dart (1 hint)
  • lib/src/impl/io.dart (1 hint)

Maintenance suggestions

The package description is too short. (-20 points)

Add more detail to the description field of pubspec.yaml. Use 60 to 180 characters to describe the package, what it does, and its target use case.

Dependencies

Package Constraint Resolved Available
Direct dependencies
Dart SDK >=2.0.0 <3.0.0