generateVersionString method

String generateVersionString(
  1. List<String> versionArray
)

Implementation

String generateVersionString(List<String> versionArray) {
  var major = versionArray[0];
  var minor = versionArray[1];
  String patch;
  if (versionArray.length > 2) {
    patch = versionArray[2];
  } else {
    patch = "";
  }
  var versionString =
      patch.padLeft(2, '0') + minor.padLeft(2, '0') + major.padLeft(2, '0');
  var version = int.parse(versionString).toRadixString(2).padLeft(18, '0');

  var patchStr = "";
  if (patch.isNotEmpty) {
    patchStr = version.substring(0, 6).toAnalyticsString();
  }
  var minorStr = version.substring(6, 12).toAnalyticsString();
  var majorStr = version.substring(12, 18).toAnalyticsString();

  return '$patchStr$minorStr$majorStr';
}