StringExt extension

on

Methods

format(List params) String

Available on String, provided by the StringExt extension

Replace all occurrences of {index} with the corresponding parameter..
formatWith(dynamic provider(String key)) String

Available on String, provided by the StringExt extension

Replaces all occurrences of {key} with the value returned by provider. If provider returns null, the original string is used.
formatWithMap(Map<String, dynamic> params) String

Available on String, provided by the StringExt extension

Replaces all occurrences of {key} with the value from params with the corresponding key. If params does not contain a value for a key, the original string is used. Example:
formatWithParameterized(dynamic provider(String key, List<String> params)) String

Available on String, provided by the StringExt extension

Replaces all occurrences of {key|param1|param2|...} with the value returned by provider. If provider returns null, the original string is used. The parameters are passed as a list to provider. Example:
padBoth(int width, [String padding = ' ']) String

Available on String, provided by the StringExt extension

Returns a string with the given width by padding it with padding. If the string is already longer than width, it is returned unchanged. If the padding cannot be evenly distributed on both sides, the right side gets the extra padding.