boltiot 0.0.3 copy "boltiot: ^0.0.3" to clipboard
boltiot: ^0.0.3 copied to clipboard

outdated

boltiot dart package for interacting with bolt cloud and wifi module.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:boltiot/boltiot.dart';
import 'package:http/http.dart' as http;
void main() {
  runApp(MyApp());
}

class MyApp extends StatelessWidget {
  // This widget is the root of your application.
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Flutter Demo',
      theme: ThemeData(
       
        primarySwatch: Colors.blue,
        
        visualDensity: VisualDensity.adaptivePlatformDensity,
      ),
      home: MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  @override
  _MyHomePageState createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  @override
  Widget build(BuildContext context) {
    String output='';
    Bolt myBolt = new Bolt('API_KEY','DEVICE_ID');         //declaring Bolt object named myBolt
    Future<http.Response> response = myBolt.digitalWrite('3', 'HIGH');   //storing future in response object
    response.then((response) {
      setState(() {                    //if Future opens with a value, store the body of response in output
        output = response.body;
      });

    });
    return Container(
      child: Center(
        child: Text(output),
      ),
    );
  }
}
0
likes
40
pub points
0%
popularity

Publisher

unverified uploader

boltiot dart package for interacting with bolt cloud and wifi module.

Repository (GitHub)
View/report issues

License

BSD-3-Clause (LICENSE)

Dependencies

flutter, http, sprintf, twilio_flutter

More

Packages that depend on boltiot