Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

error: The getter 'ltr' isn't defined for the class 'TextDirection'

Tags:

flutter

dart

any one can tell me about this error thx .

Text("مرحبا بالعالم",
                                textAlign: TextAlign.right,
                                style: TextStyle(
                                    color: Colors.white,
                                    fontWeight: FontWeight.bold,
                                    fontSize: 17),
                                textDirection: TextDirection.ltr,
                              ),

error: The getter 'ltr' isn't defined for the class 'TextDirection'

Error

like image 277
Morad N Abdulkhaliq Avatar asked Apr 18 '19 07:04

Morad N Abdulkhaliq


People also ask

What is textDirection LTR?

Ltr. Always sets the text direction to be Left to Right. TextDirection. Rtl. Always sets the text direction to be Right to Left.

How do you use text direction in flutter?

textDirection: textDirection is used to specify the direction of the text inside a Text Widget say ltr (left-to-right) or rtl (right to left). ltr is the default text direction. rtl can be used if you are building apps that supports languages like Arabic or Hebrew.


1 Answers

I had the same issue and it confused me because i wasn't using the intl package.. but since i used the easy_localization package and this one itself uses the intl package.. i figured it out that i have to hide the TextDirection class from it:

import 'package:easy_localization/easy_localization.dart' hide TextDirection;

i hope this could help anyone out there :D

like image 66
AbdulMuaz Aqeel Avatar answered Sep 22 '22 04:09

AbdulMuaz Aqeel