Skip to content

Synchronous API Possible ? #124

@AsCress

Description

@AsCress

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 ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions