Skip to content

Commit

Permalink
dartfmt
Browse files Browse the repository at this point in the history
  • Loading branch information
ilteoood committed Mar 4, 2021
1 parent 429fa84 commit 8a57451
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 10 deletions.
3 changes: 1 addition & 2 deletions bin/actions/ActionInterface.dart
Original file line number Diff line number Diff line change
@@ -1,10 +1,9 @@
import 'dart:io';

import 'package:yaml/yaml.dart';
import 'package:path/path.dart';
import 'package:yaml/yaml.dart';

abstract class AbstractAction {

List<String> get acceptedExtensions => ['.json', '.yaml', '.xml'];

void executeAction(final List<String> params);
Expand Down
3 changes: 2 additions & 1 deletion bin/actions/ValidateAction.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,8 @@ class ValidateAction extends AbstractAction {
validateMap(fileSystemEntity, content);
}

void validateMap(final FileSystemEntity fileSystemEntity, final Map? content) {
void validateMap(
final FileSystemEntity fileSystemEntity, final Map? content) {
if (content == null) {
MessagePrinter.error("Invalid file: ${fileSystemEntity.path}");
} else {
Expand Down
4 changes: 3 additions & 1 deletion lib/flutter_i18n.dart
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ class FlutterI18n {
Map<dynamic, dynamic>? decodedMap;

final _localeStream = StreamController<Locale?>.broadcast();

// ignore: close_sinks
final _loadingStream = StreamController<LoadingStatus>.broadcast();

Expand Down Expand Up @@ -90,7 +91,8 @@ class FlutterI18n {

/// Facade method to the simple translation logic
static String translate(final BuildContext context, final String key,
{final String? fallbackKey, final Map<String, String>? translationParams}) {
{final String? fallbackKey,
final Map<String, String>? translationParams}) {
final FlutterI18n currentInstance = _retrieveCurrentInstance(context)!;
final SimpleTranslator simpleTranslator = SimpleTranslator(
currentInstance.decodedMap,
Expand Down
3 changes: 2 additions & 1 deletion lib/utils/plural_translator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ class PluralTranslator extends SimpleTranslator {

String? _findParameterName(final Map<dynamic, dynamic> decodedSubMap) {
String? parameterName = "";
final String? translation = decodedSubMap[key.split(this.keySeparator!).last];
final String? translation =
decodedSubMap[key.split(this.keySeparator!).last];
if (translation != null && _parameterRegexp.hasMatch(translation)) {
final Match match = _parameterRegexp.firstMatch(translation)!;
parameterName = match.groupCount > 0 ? match.group(1)! : "";
Expand Down
11 changes: 6 additions & 5 deletions lib/utils/simple_translator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,12 @@ class SimpleTranslator {

String _translateWithKeyFallback() {
return [
_decodeFromMap(key),
_decodeFromMap(fallbackKey ?? ""),
fallbackKey,
key
].firstWhere((translation) => translation != null) ?? key;
_decodeFromMap(key),
_decodeFromMap(fallbackKey ?? ""),
fallbackKey,
key
].firstWhere((translation) => translation != null) ??
key;
}

String? _decodeFromMap(final String key) {
Expand Down

0 comments on commit 8a57451

Please sign in to comment.