k_ble_peripheral 0.0.2 copy "k_ble_peripheral: ^0.0.2" to clipboard
k_ble_peripheral: ^0.0.2 copied to clipboard

outdated

A Flutter package for using ble in Peripheral mode(both Advertising and Gatt)

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:k_ble_peripheral_example/advertise_screen/advertise_screen.dart';
import 'package:k_ble_peripheral_example/gatt_screen/gatt_screen.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({Key? key}) : super(key: key);

  @override
  _MyAppState createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {
  final pages = [AdvertiseScreen(), GattScreen()];
  var currentIndex = 0;
  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      debugShowCheckedModeBanner: false,
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Example for k_ble_peripheral'),
        ),
        body: pages[currentIndex],
        bottomNavigationBar: BottomNavigationBar(
          currentIndex: currentIndex,
          onTap: (index) {
            setState(() {
              currentIndex = index;
            });
          },
          items: [
            BottomNavigationBarItem(
              icon: Icon(Icons.online_prediction),
              label: 'Advertice',
            ),
            BottomNavigationBarItem(
              icon: Icon(Icons.settings_remote),
              label: 'GATT Service',
            ),
          ],
        ),
      ),
    );
  }
}
4
likes
0
pub points
0%
popularity

Publisher

verified publisherkeysking.com

A Flutter package for using ble in Peripheral mode(both Advertising and Gatt)

Repository (GitHub)
View/report issues

License

unknown (LICENSE)

Dependencies

flutter

More

Packages that depend on k_ble_peripheral