flutter_nordic_dfu 3.0.0 copy "flutter_nordic_dfu: ^3.0.0" to clipboard
flutter_nordic_dfu: ^3.0.0 copied to clipboard

This library allows you to do a Device Firmware Update (DFU) of your nrf51 or nrf52 chip from Nordic Semiconductor. Currently, it only works for Android.

flutter-nordic-dfu pub package #

This library allows you to do a Device Firmware Update (DFU) of your nrf51 or nrf52 chip from Nordic Semiconductor. It works for Android and iOS fine.

This is the implementation of the reference "react-native-nordic-dfu"

For more info about the DFU process, see: Resources

Run Example-->Amazing #

  1. Add your dfu zip file to example/assets/file.zip

  2. Run example project

  3. Scan device

  4. Start dfu

Usage #

startDFU #

Examples

You can pass an absolute file path or asset file to FlutterNordicDfu

Use absolute file path
/// You can define your ProgressListenerListener
await FlutterNordicDfu.startDfu(
            'EB:75:AD:E3:CA:CF', '/file/to/zip/path/file.zip',
            progressListener: ProgressListenerListener(),
         );


class ProgressListenerListener extends DfuProgressListenerAdapter {
  @override
  void onProgressChanged(String deviceAddress, int percent, double speed,
      double avgSpeed, int currentPart, int partsTotal) {
    super.onProgressChanged(
        deviceAddress, percent, speed, avgSpeed, currentPart, partsTotal);
    print('deviceAddress: $deviceAddress, percent: $percent');
  }
}

/// Or you can use DefaultDfuProgressListenerAdapter
await FlutterNordicDfu.startDfu(
      'EB:75:AD:E3:CA:CF',
      'assets/file.zip',
      fileInAsset: true,
      progressListener:
          DefaultDfuProgressListenerAdapter(onProgressChangedHandle: (
        deviceAddress,
        percent,
        speed,
        avgSpeed,
        currentPart,
        partsTotal,
      ) {
        print('deviceAddress: $deviceAddress, percent: $percent');
      }),
    );
Use asset file path
/// just set [fileInAsset] true
await FlutterNordicDfu.startDfu(
            'EB:75:AD:E3:CA:CF', 'assets/file.zip',
            progressListener: ProgressListenerListener(),
            fileInAsset: true,
         );

class ProgressListenerListener extends DfuProgressListenerAdapter {
  @override
  void onProgressChanged(String deviceAddress, int percent, double speed,
      double avgSpeed, int currentPart, int partsTotal) {
    super.onProgressChanged(
        deviceAddress, percent, speed, avgSpeed, currentPart, partsTotal);
    print('deviceAddress: $deviceAddress, percent: $percent');
  }
}

Resources #

24
likes
135
points
83
downloads

Publisher

unverified uploader

Weekly Downloads

This library allows you to do a Device Firmware Update (DFU) of your nrf51 or nrf52 chip from Nordic Semiconductor. Currently, it only works for Android.

Repository (GitHub)

Documentation

API reference

License

MIT (license)

Dependencies

flutter

More

Packages that depend on flutter_nordic_dfu