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

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> {
  String output='';
  @override
  Widget build(BuildContext context) {

    Bolt myBolt = new Bolt('API_ID','DEVICE_ID');//declaring Bolt object named myBolt
    return Scaffold(
      appBar: AppBar(title: Text('Example'),),
      body: Container(
        width: double.infinity,
        height: double.infinity,
        color: Colors.redAccent,
        child: Column(
          mainAxisAlignment: MainAxisAlignment.spaceAround,
          children: <Widget>[
            RaisedButton(
              child: Text('Press'),
                onPressed: ()async{
                  await myBolt.isOnline().then(
                          (value){
                            setState(() {
                              output = value.body;
                              //print(output);
                            });

                          }
                  );
                }
            ),
            Container(
              height: 200,
              width: 250,
              color: Colors.white,
              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