getMinMaxFrequencies static method

Future<MinMaxFrequency<int>?> getMinMaxFrequencies(
  1. int coreNumber
)

Gets the current min and max frequencies for the specified coreNumber

Implementation

static Future<MinMaxFrequency<int>?> getMinMaxFrequencies(
    int coreNumber) async {
  try {
    if (_minMaxFrequencies.containsKey(coreNumber)) {
      return _minMaxFrequencies[coreNumber];
    }
    var map = Map<int, int>.from(await _channel
        .invokeMethod('getMinMaxFrequencies', {"coreNumber": coreNumber}));
    var minMax = MinMaxFrequency(map.keys.first, map.values.first);
    _minMaxFrequencies[coreNumber] = minMax;
    return minMax;
  } on PlatformException catch (e) {
    throw 'Failed to retrieve current frequency for the core ${e.code}: ${e.message}';
  }
}