apple method
Returns device name of machine
.
machine
is device identifier.
Reference is "https://gist.github.com/adamawolf/3048717".
Implementation
Future<String?> apple(String? machine) async {
final appleDeviceName = AppleDeviceName();
final response = await appleDeviceName.fetch();
final devices = appleDeviceName.getDevices(response.body);
return devices
.cast<AppleDeviceModel?>()
.firstWhere((e) => e?.id == machine, orElse: () => null)
?.name;
}