-
Notifications
You must be signed in to change notification settings - Fork 2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Proposal to encapsulate device access to a dedicated class #18
Comments
Example code: final sane = Sane();
final devices = await sane.getDevices(localOnly: false);
for (final device in devices) {
print(device.name);
}
final device = devices.first;
final stream = device.read();
await for (final message in stream) {
print(message);
} |
@Jupi007 Moving here: I understand your viewpoint. In my opinion we aren't crossing the line or taking away what a potential cross-platform library would do or implement. In my view, we are complementing how SANE as an API functions, if there's a handle, that needs to be taken care of, that's obviously an instance/object. We wouldn't take away control over anything, but instead expose the exact same functionality but more akin to Dart's and Flutter's APIs. I would like to see implementers manage handles using composition and have our library provide a safe interface. I still think if someone wanted complete control of every function call, this enters the territory where the developer could just implement the SANE API themselves. In a way, the purist interface you describe is already what But we can ignore this topic for now, if you'd like. |
I get your point. I agree that nobody should use the low level stuff in a frontend. I really don't care about provide the exact same API as the C one :D
I also aim this target 👍 |
sane_get_devices
sane_exit
sane_open
sane_read
sane_close
Becomes:
Sane
List<SaneDevice> getDevices
dispose()
(exit()
)SaneDevice
(open()
when used)start()
cancel()
read()
dispose()
(close()
)The text was updated successfully, but these errors were encountered: