简体   繁体   中英

Flutter and linux

I want to create a flutter plugin for Linux. I don't know very well C++ but I want to try. Is it a good idea to create shell command in C++ ? For example if I need Bluetooth devices and I do

auto pPipe = ::popen("bluetoothctl scan on", "r");

And read ouptut stream to get scan result, is it a good practice in C++ ? Bluetooth is for example, but it would be wifi, 4G, etc ...

There's nothing inherently wrong with using popen , but it's a pretty heavyweight approach, and if you do it often for relatively transient commands you'll probably be putting more load on the system than another app that embeds or links code to do something equivalent. Separately, using popen may or may not make it easier to maintain your program - depending on whether the tools you use change their command line options, change their output, and remain available on the distros you want to support etc..

Is your package/plugin ready yet? I am looking for such tools. Also if you need assistance with this package, i would love to contribute.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM