lifx 0.2.1

  • README.md
  • Example
  • Installing
  • Versions
  • new46

dart_lifx

Another attempt at a LIFX library, this time written in Dart.

  • Requires LIFX API key when creating a new object.
  • Optional named parameter, loggingEnabled enables or disables status codes and response body printing.
import 'package:lifx/lifx.dart';

void main() {
    var lifx = new LIFX("api_key_here", loggingEnabled: true);

    lifx.getLights().then((res) => print(res));
}

Methods

All methods are asynchronous and most contain optional light parameter, by default all lights are selected. Pass light ID, found with getLights() to control individual lights.

Read more about setState here.

Future<Map> getLights({String light = "all"})
Future<Map> getScenes()
Future<bool> activateScene(String uuid, {double duration = 1.0})
Future<bool> togglePower({String light = "all"}) 
Future<bool> setState({String light = "all", String power = "on", String color = "", double brightness = 0.5, double duration = 1.5, double infrared = 0.0})

Extra

Gets the hexidecimal value from standard RGB (0 - 255) values to easily set color in setState().

String getHexFromRGB(int red, int green, int blue)

example/main.dart

import 'package:lifx/lifx.dart';
import 'dart:io' show Platform;

void main() {
    Map<String, String> envVars = Platform.environment;

    var lifx = new LIFX(envVars["DART_LIFX"], loggingEnabled: false);
    lifx.setState(brightness: 0.5, color: "red").then((res) => print(res));
}

Use this package as a library

1. Depend on it

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


dependencies:
  lifx: "^0.2.1"

2. Install it

You can install packages from the command line:

with pub:


$ pub get

with Flutter:


$ flutter packages get

Alternatively, your editor might support pub get or 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:lifx/lifx.dart';
  
Version Uploaded Documentation Archive
0.2.1 May 9, 2018 Go to the documentation of lifx 0.2.1 Download lifx 0.2.1 archive
0.2.0 May 8, 2018 Go to the documentation of lifx 0.2.0 Download lifx 0.2.0 archive
0.1.0 May 8, 2018 Go to the documentation of lifx 0.1.0 Download lifx 0.1.0 archive

Analysis

We analyzed this package on May 22, 2018, and provided a score, details, and suggestions below. Analysis was completed with status completed using:

  • Dart: 2.0.0-dev.54.0
  • pana: 0.11.1

Scores

Popularity:
Describes how popular the package is relative to other packages. [more]
0 / 100
Health:
Code health derived from static analysis. [more]
99 / 100
Maintenance:
Reflects how tidy and up-to-date the package is. [more]
80 / 100
Overall score:
Weighted score of the above. [more]
46
Learn more about scoring.

Platforms

Detected platforms: Flutter, web, other

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

Suggestions

  • Maintain CHANGELOG.md.

    Changelog entries help clients to follow the progress in your code.

  • Package is pre-v1 release.

    While there is nothing inherently wrong with versions of 0.*.*, it usually means that the author is still experimenting with the general direction API.

  • Fix analysis and formatting issues.

    Analysis or formatting checks reported 1 hint.

    Run dartfmt to format lib/lifx.dart.

Dependencies

Package Constraint Resolved Available
Direct dependencies
convert >=2.0.1 <3.0.0 2.0.1
hex >=0.1.1 <0.2.0 0.1.1
http >=0.11.3+16 <0.12.0 0.11.3+16
json_object >=1.0.19+1 <2.0.0 1.0.19+1
test >=0.12.0-beta.4 <0.13.0 0.12.38+1
unittest >=0.11.7 <0.12.0 0.11.7 0.12.4+1
Transitive dependencies
analyzer 0.32.0
args 1.4.3
async 2.0.7
boolean_selector 1.0.3
charcode 1.1.1
collection 1.14.9
crypto 2.0.3
csslib 0.14.4
front_end 0.1.0
glob 1.1.5
html 0.13.3
http_multi_server 2.0.4
http_parser 3.1.2
io 0.3.2+1
js 0.6.1
kernel 0.3.0
logging 0.11.3+1
matcher 0.12.2+1
meta 1.1.5
mime 0.9.6+1
multi_server_socket 1.0.1
node_preamble 1.4.1
package_config 1.0.3
package_resolver 1.0.2
path 1.5.1
plugin 0.2.0+2
pool 1.3.5
pub_semver 1.4.1
shelf 0.7.3
shelf_packages_handler 1.0.3
shelf_static 0.2.7
shelf_web_socket 0.2.2+1
source_map_stack_trace 1.1.4
source_maps 0.10.5
source_span 1.4.0
stack_trace 1.9.2
stream_channel 1.6.6
string_scanner 1.0.2
term_glyph 1.0.0
typed_data 1.1.5
utf 0.9.0+4
watcher 0.9.7+7
web_socket_channel 1.0.7
yaml 2.1.13