loadPlatformInfo function
Implementation
Future<DeviceInfo> loadPlatformInfo() async {
// List languages = await Devicelocale.preferredLanguages;
// String locale = await Devicelocale.currentLocale;
IpStackResponse? auth;
try {
/// Remove hard-coded later
auth = await IpStack.ofBaseUrl("08c386683f65cfe7e4cbeab9e4c05661",
baseUrl: rproxy.ipstack())
.requester();
} catch (e) {
_log.info("Couldn't get coords: $e");
}
return DeviceInfo(
ipAddress: auth?.ip,
isSimulator: false,
locale:
"${auth?.location?.languages?.firstOrNull()?.code ?? 'en'}-${auth?.countryCode ?? "us"}",
geo: geo = GeoPoint.of(auth?.latitude, auth?.longitude),
language: auth?.location?.languages?.firstOrNull()?.code ?? 'en',
deviceType: "browser",
software: "browser",
deviceBrand: browser.name,
deviceModel: browser.className,
deviceId: uuid(),
softwareVersion: "${browser.version}",
);
}