configOrFallback method

Future<OryksaTvConfig> configOrFallback()

Like config, but when the server cannot be reached returns a configuration with the English fallback texts (the pieces keep working, without the server's texts).

Implementation

Future<OryksaTvConfig> configOrFallback() async {
  try {
    return await config();
  } catch (e) {
    debugPrint('ORYKSA TV: could not read the configuration ($e); using the fallback.');
    return OryksaTvConfig(
      locale: _locale,
      presenterName: 'ORYKSA',
      presenterAvatar: OryksaTvConfig.defaultAvatar,
      fromServer: false,
    );
  }
}