This is not an issue but more of a general question based on this library and others of this type as well.
I was wondering if a synchronous API is possible using dart, i.e., something which waits until the read/write operation is completed ?
The library used here, i.e., https://github.com/felHR85/UsbSerial, also provides a synchronous API, with functions such as syncRead(), syncWrite() and syncOpen().
Can we somehow create a wrapper around these in dart which is not async and doesn't return a subtype of Future?
I was currently working on a project wherein I require synchronous communication, and currently I am using a combination of returning Future and async in all my functions that use my main read and write functions (implemented using this package), and then await for the response in all of them (something like the discussion here).
And if possible, would that be recommended considering that dart is designed to handle I/O tasks asynchronously ? I am wondering if working in that direction (if possible) is fruitful or my Future, async and await approach is fine ?
This is not an issue but more of a general question based on this library and others of this type as well.
I was wondering if a synchronous API is possible using
dart, i.e., something which waits until the read/write operation is completed ?The library used here, i.e., https://github.com/felHR85/UsbSerial, also provides a synchronous API, with functions such as
syncRead(),syncWrite()andsyncOpen().Can we somehow create a wrapper around these in dart which is not
asyncand doesn't return a subtype ofFuture?I was currently working on a project wherein I require synchronous communication, and currently I am using a combination of returning
Futureandasyncin all my functions that use my mainreadandwritefunctions (implemented using this package), and thenawaitfor the response in all of them (something like the discussion here).And if possible, would that be recommended considering that dart is designed to handle I/O tasks asynchronously ? I am wondering if working in that direction (if possible) is fruitful or my
Future,asyncandawaitapproach is fine ?