k_ble_peripheral 0.0.4 icon indicating copy to clipboard operation
k_ble_peripheral: ^0.0.4 copied to clipboard

PlatformAndroid

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',
            ),
          ],
        ),
      ),
    );
  }
}
3
likes
120
pub points
19%
popularity

Publisher

verified publisher iconkeysking.com

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

Repository (GitHub)

Documentation

API reference

License

Icon for licenses.Apache-2.0 (LICENSE)

Dependencies

flutter

More

Packages that depend on k_ble_peripheral