sebastianhaberey / nsd

Flutter Network Service Discovery (NSD) Plugin
61 stars 30 forks source link

Check Windows Version on startup #22

Closed xmine64 closed 2 years ago

xmine64 commented 2 years ago

Description

Is it possible to check Windows version on startup, and don't call unsupported APIs on lower versions of Windows? My app crashes on older versions of Windows because there's no DnsServiceConstructInstance in DNSAPI.dll, if you could add a version check before calling that it would be fine just discovery service won't work, instead of crashing.

Scenario

Use the plugin in my own application via Flutter dependency

Platform

Windows

sebastianhaberey commented 2 years ago

I've added a system requirements check for Windows: startDiscovery() and register() now throw a NsdError with cause operationNotSupported if the OS doesn't match requirements. This way you can catch the error and react in your application accordingly (or just ignore it). Please try the new version (2.2.2) and see if this helps you.

sebastianhaberey commented 2 years ago

Fixed missing enum, so version 2.2.3 it is.

xmine64 commented 2 years ago

Thanks.