fetchDemographic method Null safety
토큰 등록시 필요한 부가정보를 가져옵니다.
Implementation
void fetchDemographic() async {
DeviceInfoPlugin deviceInfo = DeviceInfoPlugin();
PackageInfo packageInfo = await PackageInfo.fromPlatform();
demographic = {};
if (Platform.isIOS) {
IosDeviceInfo iosDeviceInfo = await deviceInfo.iosInfo;
demographic = {
"appVersion": packageInfo.version,
"make": "Apple",
"model": iosDeviceInfo.model ?? "",
"modelVersion": iosDeviceInfo.utsname.machine ?? "",
"platform": iosDeviceInfo.systemName ?? "",
"platformVersion": iosDeviceInfo.systemVersion ?? "",
};
} else if (Platform.isAndroid) {
AndroidDeviceInfo androidDeviceInfo = await deviceInfo.androidInfo;
demographic = {
"appVersion": packageInfo.version,
"make": androidDeviceInfo.manufacturer ?? "",
"model": androidDeviceInfo.model ?? "",
"modelVersion": androidDeviceInfo.display ?? "",
"platform": "Android",
"platformVersion": androidDeviceInfo.version.release ?? "",
};
}
}