formatMap method
Format a string.
Implementation
String formatMap(Map<String, Object> args) {
if (this == null) {
throw ArgumentError('string: $this');
}
return this!.replaceAllMapped(RegExp(r'\{(\w+)\}'), (match) {
final key = match.group(1)!;
if (!args.containsKey(key)) {
throw ArgumentError('key: $key');
}
return args[key]!.toString();
});
}