getSupportedExerciseTypes method

Future<List<ExerciseType>> getSupportedExerciseTypes()

Wear OS: The supported ExerciseTypes of the device

Tizen: Always empty

Implementation

Future<List<ExerciseType>> getSupportedExerciseTypes() async {
  if (!Platform.isAndroid) return [];

  final result =
      await _channel.invokeListMethod<int>('getSupportedExerciseTypes');

  final types = <ExerciseType>[];
  for (final id in result!) {
    final type = ExerciseType.fromId(id);
    if (type == null) {
      debugPrint(
        'Unknown ExerciseType id: $id. Please create an issue for this on GitHub.',
      );
    } else {
      types.add(type);
    }
  }

  return types;
}