Praveen Ramalingam
Praveen Ramalingam

Reputation: 1067

Flutter:Adding price sign with string in strings.arb creating expected an identifier in i18n file(localization)

code:
Strings.arb
  "priceSign": "S$",
i18n.dart
  String priceSign(String ) => "S$";//Expected an identifier error

How can i add localization for such a string in flutter.I can't able to create such a String in arb file and generate i18n.

ANyone help me resolve this issue.

Upvotes: 1

Views: 1292

Answers (2)

D Cruse
D Cruse

Reputation: 447

In your ARB files you don't need to escape $, but in your dart getter code you should.

Strings.arb:

"priceSign": "S$",

i18n.dart:

String priceSign(String ) => "S\$";

If you use intl_translation tool, it will map it properly between those two formats.

Upvotes: 0

Hitesh Dhamshaniya
Hitesh Dhamshaniya

Reputation: 2182

You can define as below.

"price_sign" : "\$"

Its show red under line but you can ignore it and run application. It will work.

Upvotes: 2

Related Questions