hue_dart 0.1.2 copy "hue_dart: ^0.1.2" to clipboard
hue_dart: ^0.1.2 copied to clipboard

outdated

A library for creating Philips Hue apps in Flutter and/or AngularDart.

example/example.dart

import 'package:http/http.dart';
import 'package:hue_dart/src/core/bridge.dart';
import 'package:hue_dart/src/core/bridge_discovery.dart';
import 'package:hue_dart/src/light/light.dart';

main(List<String> arguments) async {

  final client = new Client();
  /// search for bridges
  final discovery = new BridgeDiscovery(client);

  List<DiscoveryResult> discoverResults = await discovery.automatic();
  final discoveryResult = discoverResults.first;

  //create bridge
  var bridge = new Bridge(client, discoveryResult.ipAddress);

  /// create a user, press the push link button before calling this
  final whiteListItem = await bridge.createUser('dart_hue#example');

  // use username for consequent calls to the bridge
  bridge.username = whiteListItem.username;

  /// get lights
  List<Light> lights = await bridge.lights();

  // update light state
  final light = lights.first;
  light.state.on = true;
  light.state.brightness = 10;
  await bridge.updateLightState(light);
}
20
likes
0
pub points
31%
popularity

Publisher

verified publishergrinn.nl

A library for creating Philips Hue apps in Flutter and/or AngularDart.

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

http, intl, json_serializable

More

Packages that depend on hue_dart