ble_reader 0.1.0 copy "ble_reader: ^0.1.0" to clipboard
ble_reader: ^0.1.0 copied to clipboard

PlatformAndroidiOS
outdated

This plugin allows you to enable peripheral mode and stream all data that is received via Bluetooth Low Energy network as ervices and characteristics.

example/lib/main.dart

import 'package:ble_reader/ble_reader.dart';
import 'package:flutter/material.dart';

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

class MyApp extends StatefulWidget {
  const MyApp({super.key});

  @override
  State<MyApp> createState() => _MyAppState();
}

class _MyAppState extends State<MyApp> {

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      home: Scaffold(
        appBar: AppBar(
          title: const Text('Plugin example app'),
        ),
        body: Center(
          child: Column(
            children: [
              TextButton(
                onPressed: () async {
                  final result = await BleReader.setupConnection;
                  print('Example app Logs: setupConnection result = $result');
                },
                child: Text('setupConnection'),

              ),
              TextButton(
                onPressed: () {},
                child: Text('testService'),

              ),
              StreamBuilder(
                stream: BleReader.receivedDataStream,
                initialData: 'None',
                builder: (BuildContext context,
                    AsyncSnapshot<dynamic> snapshot) {
                  return Text('Data received: ${snapshot.data}');
                },
              ),
            ],
          ),
        ),
      ),
    );
  }
}
9
likes
140
points
23
downloads

Publisher

verified publisheramoriodi.xyz

Weekly Downloads

This plugin allows you to enable peripheral mode and stream all data that is received via Bluetooth Low Energy network as ervices and characteristics.

Repository (GitHub)

Documentation

API reference

License

BSD-3-Clause (license)

Dependencies

flutter, plugin_platform_interface

More

Packages that depend on ble_reader