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

A Flutter package to control the intelbras CPEs that contain the bifrost api embedded.

example/lib/main.dart

import 'dart:async';
import 'package:bifrost_wireless_api/bifrost_wireless_api.dart';
import 'package:flutter/material.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'Wifi Control',
      theme: ThemeData(
        primarySwatch: Colors.orange,
      ),
      home: const MyHomePage(title: 'Hi'),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key, required this.title});

  final String title;

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  String myIp = '192.168.1.1';
  Timer? myTimer;
  String? tryToken;
  BifrostApi bifrost = BifrostApi();
  updatePage() {
    myTimer = Timer.periodic(const Duration(seconds: 1), (timer) async {
      tryToken = checkSessionActive;
      if (tryToken != null) {
        bifrost.getWireless(myIp, tryToken, context);
        if (checkWifiInfo) {
          setState(() {
            myTimer?.cancel();
            isLogged();
          });
        }
      }
    });
  }

  isLogged() {
    if (tryToken != null) {
      final token = tryToken ?? '0';
      return WlanView(myIp, token);
    } else {
      return Login(myIp);
    }
  }

  @override
  void initState() {
    updatePage();
    super.initState();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: Text(widget.title),
      ),
      body: Center(
        child: Column(
          mainAxisAlignment: MainAxisAlignment.center,
          children: <Widget>[isLogged()],
        ),
      ),
    );
  }
}
2
likes
140
points
47
downloads

Publisher

unverified uploader

Weekly Downloads

A Flutter package to control the intelbras CPEs that contain the bifrost api embedded.

Repository (GitHub)
View/report issues

Documentation

API reference

License

MIT (license)

Dependencies

event_bus_plus, flutter, flutter_pw_validator, get_it, http

More

Packages that depend on bifrost_wireless_api