38

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'),
);
Christopher Moore
  • 15,626
  • 10
  • 42
  • 52
Mary Seleznova
  • 791
  • 1
  • 10
  • 18
  • https://www.fileformat.info/info/unicode/char/00a9/index.htm .try this link for unicode character – lava Feb 21 '22 at 10:41

6 Answers6

53

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

Günter Zöchbauer
  • 623,577
  • 216
  • 2,003
  • 1,567
12

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 ...

copyright and emoji

Pretty cool capability to enable characters not generally typeable on many keyboards - even Emoji :-) ...

babernethy
  • 1,057
  • 1
  • 9
  • 16
8

To add any special character, You can use its unicode.

The unicode for Copyright Sign is 00a9

You can use it like this: new Text("2018 \u00a9 Author's Name");

You can find unicode of any characters from here.

Dhrumil Shah - dhuma1981
  • 15,166
  • 6
  • 31
  • 39
3

If you're getting the text from api. You can do this:

Text(utf8.decode(text.codeUnits)
Jasper Diongco
  • 221
  • 3
  • 4
2

First thing is to add this plugin to your flutter application charcode: (there is no need to add a version)

to display Text('2018 (c) Author's Name')

simply use type this Text ("2018 ${String.fromCharCode(0x00A9) Author's name")

this will work, the charcode for copyright symbol is 0x00A9, you can check out this link for any special character like euro, gamma, epsilon, and if you want to use them add them the same way I added the copyright code i.e StringfromCharCode(charcode of the special character)

0

You can do it very easily using double quotes.

Widget copyrightText = new Container(
  padding: const EdgeInsets.only(left: 32.0, right: 32.0),
  child: Text("2018 (c) Author's Name"),
);
atasumt
  • 23
  • 7