load method

  1. @override
Future<Map<String, String>> load(
  1. String language,
  2. Translator translator
)
override

This will call the loader and then immediately resolve the Future with an empty map. Once the associated loader's Future resolves, this will then apply the values to the translator.

Implementation

@override
Future<Map<String, String>> load(
  String language,
  Translator translator,
) {
  final future = loader.load(
    language,
    translator,
  );
  future
      .then(
    (value) => translator.apply(language, value),
  )
      .catchError(
    (e, stack) {
      if (e is FlutterErrorDetails) {
        FlutterError.reportError(e);
      } else {
        FlutterError.reportError(
          FlutterErrorDetails(
            exception: e,
            stack: stack,
          ),
        );
      }
    },
  );

  return Future.value(<String, String>{});
}