Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

The argument type 'TextDirection' can't be assigned to the parameter type 'TextDirection?'

Tags:

flutter

dart

there is a simple TextField and I want to give it TextDirection the problem is that it i encounter the error i said

TextField(
   textDirection: TextDirection.RTL,
)
like image 723
Ardeshir ojan Avatar asked Dec 21 '25 08:12

Ardeshir ojan


1 Answers

The problem was that the easy_localization package won't allow to use rtl in text direction.
I used it by importing tha package and adding its alias

import 'package:easy_localization/easy_localization.dart' as localized;

localized.TextDirection.rtl


**UPDATE 2024**

Instead of importing the other package just add this import:

import 'dart:ui' as ui;

And edit your code this way:

textDirection: ui.TextDirection.rtl
like image 70
Ardeshir ojan Avatar answered Dec 23 '25 22:12

Ardeshir ojan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!