getInformation method

Future<Map<String, String>> getInformation()

Implementation

Future<Map<String, String>> getInformation() async {
  var resultInfo = <String, String>{};

  var applicationType = 'web';
  var applicationVersion = 'unknown_version';
  var applicationBuildCode = '0';
  var applicationName = 'unknown_name';

  var _appMapData = await _getVersionJsonData();
  if (_appMapData.isNotEmpty) {
    if (_appMapData['app_name'] != null) {
      applicationName = _appMapData['app_name'];
    }
    if (_appMapData['version'] != null) {
      applicationVersion = _appMapData['version'];
    }
    if (_appMapData['build_number'] != null) {
      applicationBuildCode = _appMapData['build_number'];
    }
  }

  var os = _getOS();
  var osName = os.name;
  var osVersion = os.version;
  var osVersionCode = _getOsVersionCode(osVersion);
  var browser = _getBrowser();
  var deviceId = _getDeviceId();
  var deviceName =
      '${os.name} ${os.version}/${browser.name} ${browser.version}';

  resultInfo['deviceId'] = deviceId;
  resultInfo['deviceName'] = deviceName;
  resultInfo['osName'] = osName;
  resultInfo['osVersion'] = osVersion;
  resultInfo['osVersionCode'] = osVersionCode.toString();
  resultInfo['softwareName'] = browser.name;
  resultInfo['softwareVersion'] = browser.version;
  resultInfo['applicationId'] = applicationName;
  resultInfo['applicationType'] = applicationType;
  resultInfo['applicationName'] = applicationName;
  resultInfo['applicationVersion'] = applicationVersion;
  resultInfo['applicationBuildCode'] = applicationBuildCode;
  return Future.value(resultInfo);
}