Code Monkey home page Code Monkey logo

Comments (6)

fengqiangboy avatar fengqiangboy commented on May 28, 2024

Current, you should pass a absolute path to FlutterNordicDfu.startDfu like /data/local/tmp/file.zip.

In plugin, it use File(path) to open it

from flutter-nordic-dfu.

Prathik-Jain avatar Prathik-Jain commented on May 28, 2024

@fengqiangboy Absolute path from the root of the app?
Should It be updated in the pubspec.yaml as well?
Example would be much appreciated 😄

As you have used assets/file.zip in your example itself

from flutter-nordic-dfu.

fengqiangboy avatar fengqiangboy commented on May 28, 2024

In early version, I use assets/file.zip to test, because at the time I use a tool to get Asset file in native code, but it would import third dependent, so I remove it now.

I will consider how to achieve better implementation that can get flutter assets file path in native code.

from flutter-nordic-dfu.

Prathik-Jain avatar Prathik-Jain commented on May 28, 2024

Oh, which plugin did you use earlier? can you also give me an estimate on how long will you take to implement your version of the same?

I'll keep this issue open until then.

from flutter-nordic-dfu.

fengqiangboy avatar fengqiangboy commented on May 28, 2024

Use com.blankj:utilcode,

the code look like:

// assets file from flutter
filePath = "assets/file.zip"

filePath = registrar.lookupKeyForAsset(filePath)

val tempFileName = PathUtils.getExternalAppCachePath() + UUID.randomUUID().toString()

// copy asset file to temp path
ResourceUtils.copyFileFromAssets(filePath, tempFileName)

// now, the path is an absolute path, and can pass it to nordic dfu libarary
filePath = tempFileName

from flutter-nordic-dfu.

fengqiangboy avatar fengqiangboy commented on May 28, 2024

Current, it can support asset file in flutter, you can try it in version 2.0.0

await FlutterNordicDfu.startDfu(
            'EB:75:AD:E3:CA:CF', 'assets/file.zip',
            progressListener: ProgressListenerListener(),

/// asset file should add this parameter
            fileInAsset: true,
         );

from flutter-nordic-dfu.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.