DarkstormBackend constructor
DarkstormBackend({})
Implementation
DarkstormBackend(
{required this.baseUrl,
required this.apiKey,
Uri? internetCheckAddress,
this.waitForInternet = true,
this.onError})
: con = InternetConnection.createInstance(
customCheckOptions: internetCheckAddress != null
? [InternetCheckOption(uri: internetCheckAddress)]
: null,
useDefaultOptions: internetCheckAddress == null) {
platform.when(
io: () => platform.when(
fuchsia: () => plat = "fuchsia",
windows: () => plat = 'windows',
android: () => plat = 'android',
iOS: () => plat = 'iOS',
macOS: () => plat = 'macOS',
linux: () => plat = 'linux',
unknown: () => plat = 'unknown',
),
web: () => plat = "web",
unknown: () => plat = "unknown");
con.internetStatus.then(
(value) => _internetAvailable = value == InternetStatus.connected);
con.onStatusChange.listen(
(event) => _internetAvailable = event == InternetStatus.connected);
}