generateMacAddress static method

Future<String> generateMacAddress()

generate Virtual Mac Address

Implementation

static Future<String> generateMacAddress() async {
  final deviceInfo = await DeviceInfoPlugin().deviceInfo;
  String id = "undefined";
  if (Platform.isAndroid) {
    id = deviceInfo.data["id"];
  } else if (Platform.isIOS) {
    id = deviceInfo.data["identifierForVendor"];
  }
  final buffer = StringBuffer();
  for (int b in sha256.convert(id.codeUnits).bytes) {
    buffer.write("${b.toRadixString(16)}:");
  }
  return buffer.toString().substring(0, 16);
}