How can I add a special character (e.g., copyright sign instead of (c)) in the following example:
Widget copyrightText = new Container( padding: const EdgeInsets.only(left: 32.0, right: 32.0), child: Text('2018 (c) Author's Name'), );
How do you add special characters to a string in flutter? Escaping every special character. Like many programming languages, you can escape special characters in a Dart string by using “\” (backslash). Display text as a raw string.
How do you remove a character from a string in flutter? We have used the replaceAll() method on string with RegEx expression to remove the special characters. It will give you the alphabets and numbers both and Special characters will be removed.
You can add it as unicode like
child: new Text('2018 \u00a9 Author's Name'),
or
child: new Text('2018 © Author's Name'),
See also
Only one other thing to add.
Dart/Flutter add another concept of "Runes" which are integer/Unicode representations of Strings (beyond what you can type) ... e.g.
var myRichRunesMessage = new Runes('2018 \u00a9 Author\'s Name \u{1f60e}'); print(new String.fromCharCodes(myRichRunesMessage));
Which would render something like this ...
Pretty cool capability to enable characters not generally typeable on many keyboards - even Emoji :-) ...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With