Fixed Text Formatter on dynamic to string
This commit is contained in:
parent
0cf5803ac5
commit
39df2111f7
@ -31,3 +31,6 @@
|
||||
|
||||
## 1.0.7
|
||||
- Removed example "example_flutter_secure_storage_provider.dart"
|
||||
|
||||
## 1.0.8
|
||||
- Fixed Text Formatter on dynamic to string
|
@ -10,22 +10,40 @@ class TextFormatter {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (args.isEmpty) {
|
||||
return text;
|
||||
}
|
||||
|
||||
var msg = text;
|
||||
args.asMap().forEach((index, element) {
|
||||
msg = msg?.replaceAll('{$index}', element);
|
||||
var _replaced = '';
|
||||
if (element != null) {
|
||||
_replaced = element.toString();
|
||||
}
|
||||
|
||||
msg = msg?.replaceAll('{$index}', _replaced);
|
||||
});
|
||||
|
||||
return msg;
|
||||
}
|
||||
|
||||
String? decorate(Map<String, dynamic> args) {
|
||||
String? decorate(Map<String, dynamic> params) {
|
||||
if (text == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
if (params.isEmpty) {
|
||||
return text;
|
||||
}
|
||||
|
||||
var msg = text;
|
||||
args.forEach((index, element) {
|
||||
msg = msg?.replaceAll('{$index}', element);
|
||||
params.forEach((index, element) {
|
||||
var _replaced = '';
|
||||
if (element != null) {
|
||||
_replaced = element.toString();
|
||||
}
|
||||
|
||||
msg = msg?.replaceAll('{$index}', _replaced);
|
||||
});
|
||||
|
||||
return msg;
|
||||
|
@ -1,6 +1,6 @@
|
||||
name: configurable
|
||||
description: System Configuration and Dotenv Environment for Dart and Flutter
|
||||
version: 1.0.7
|
||||
description: System Configuration, Dotenv Environment and Text Formatter for Dart and Flutter
|
||||
version: 1.0.8
|
||||
homepage: https://github.com/CUBETIQ/system-config-dart
|
||||
repository: https://github.com/CUBETIQ/system-config-dart.git
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user