Task: Add TextFormatter function to format the string with args
This commit is contained in:
14
example/text_formatter_example.dart
Normal file
14
example/text_formatter_example.dart
Normal file
@@ -0,0 +1,14 @@
|
||||
import 'package:configurable/text_formatter.dart';
|
||||
|
||||
void main(List<String> args) {
|
||||
var text1 = 'Hello, {0}, then do this it by {1}!';
|
||||
var text2 = 'Hello, {firstName}, then do this it by {lastName}!';
|
||||
var result1 = TextFormatter(text1).format(['Sambo', 'Chea']);
|
||||
var result2 = TextFormatter(text2).decorate({
|
||||
'firstName': 'Sambo',
|
||||
'lastName': 'Chea',
|
||||
});
|
||||
|
||||
print('Result 1 => $result1');
|
||||
print('Result 2 => $result2');
|
||||
}
|
||||
Reference in New Issue
Block a user