provideDefaultId function
Package internal method to create a default customId even there are
null on Spotter().initializeEngine()
Implementation
Future<String> provideDefaultId() async {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
if (kIsWeb) {
WebBrowserInfo webBrowserInfo = await deviceInfo.webBrowserInfo;
return webBrowserInfo.browserName.name;
}
switch (defaultTargetPlatform) {
case TargetPlatform.android:
AndroidDeviceInfo androidInfo = await deviceInfo.androidInfo;
return androidInfo.model;
case TargetPlatform.iOS:
IosDeviceInfo iosInfo = await deviceInfo.iosInfo;
return iosInfo.model;
case TargetPlatform.macOS:
MacOsDeviceInfo macOsInfo = await deviceInfo.macOsInfo;
return macOsInfo.model;
case TargetPlatform.windows:
WindowsDeviceInfo windowsInfo = await deviceInfo.windowsInfo;
return windowsInfo.deviceId;
case TargetPlatform.linux:
LinuxDeviceInfo linuxInfo = await deviceInfo.linuxInfo;
return linuxInfo.name;
default:
throw UnsupportedError(
'DefaultFirebaseOptions are not supported for this platform.',
);
}
}