cachedVersionInfo abstract method

Future<VersionInfoResponse> cachedVersionInfo()

Returns cached metadata about the configuration of the Duolingo service.

The first call to this cachedVersionInfo method will always result in a communication with the Duolingo API because there is no cached VersionInfoResponse. In the second and subsequent method calls, the cached VersionInfoResponse from the first method call will be returned.

The type and data structure of the response is consistent with the versionInfo method. However, please note that the cached data is returned from this method, so unless you explicitly delete this cached object data, the cached response object will always be returned.

To delete the explicitly cached VersionInfoResponse, call the cleanCacheVersionInfo method.

Example:

void main() async {
 final duolingo = Duolingo.instance;

 final versionInfoResponse = await duolingo.cachedVersionInfo();
 final ttsVoiceConfiguration = versionInfoResponse.ttsVoiceConfiguration;

 for (final voiceDirection in ttsVoiceConfiguration.voiceDirections) {
   print(voiceDirection.language);
   print(voiceDirection.voice);
 }

 // Delete cache.
 duolingo.cleanCacheVersionInfo();
}

Implementation

Future<VersionInfoResponse> cachedVersionInfo();