getLanguages method

  1. @override
Future<List<String>> getLanguages()
override

Implementation

@override
Future<List<String>> getLanguages() async {
  if (_cachedLanguages != null) return _cachedLanguages!;

  final result = await methodChannel.invokeMethod(methods.getLanguages);

  if (result is List) {
    final output = result.map((data) => data.toString()).toList();
    _cachedLanguages = output;
    return output;
  } else {
    _debugPrint(
      '${methods.getLanguages}: Expected List but got ${result.runtimeType}',
    );
    return [];
  }
}