trWithArgs method

String trWithArgs(
  1. Map<String, Object?> args
)

Translates this key via LocalizeIt.translate and replaces every {name} placeholder with the matching value from args.

'Hallo {name}'.trWithArgs({'name': username})

Placeholders without a matching entry in args are left untouched.

Implementation

String trWithArgs(Map<String, Object?> args) {
  var result = LocalizeIt.translate(this);
  args.forEach((name, value) {
    result = result.replaceAll('{$name}', '${value ?? ''}');
  });
  return result;
}