updateFeatureLevel function

Future<bool> updateFeatureLevel(
  1. dynamic lang,
  2. dynamic space,
  3. String levelKey,
  4. String featureName,
  5. int? newPowerLevel,
)

Implementation

Future<bool> updateFeatureLevel(
  L10n lang,
  Space space,
  String levelKey,
  String featureName,
  int? newPowerLevel,
) async {
  EasyLoading.show(status: lang.changingSettingOf(featureName));
  try {
    final res = await space.updateFeaturePowerLevels(
      levelKey,
      newPowerLevel,
    );
    EasyLoading.showToast(lang.powerLevelSubmitted(featureName));
    return res;
  } catch (e, s) {
    _log.severe('Failed to change power level of $featureName', e, s);
    EasyLoading.showError(
      lang.failedToChangePowerLevel(e),
      duration: const Duration(seconds: 3),
    );
    return false;
  }
}