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));


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})


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

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