getRandomSaying static method
Implementation
static Future<Saying> getRandomSaying({
SayingType? type,
Language? language,
}) async {
final sayingType = type ?? _getRandomType();
final currentLanguage = language ?? _getCurrentLanguage();
final sayings = await getSayingsByType(sayingType, currentLanguage);
if (sayings.isEmpty) {
throw Exception('No Found Sayings');
}
final random = Random();
return sayings[random.nextInt(sayings.length)];
}