by @kodeazy

flutter No Directionality widget found?

Home » flutter » flutter No Directionality widget found?

I have an error as below screenshot Image not found

Below is my code

import 'package:flutter/material.dart';
void main() => runApp(const LogoApp());
class LogoApp extends StatefulWidget {
  const LogoApp({super.key});

  State<LogoApp> createState() => _LogoAppState();
class _LogoAppState extends State<LogoApp> with SingleTickerProviderStateMixin {
  late Animation<double> animation;
  late AnimationController controller;
  void initState() {
    controller =
        AnimationController(duration: const Duration(seconds: 1), vsync: this);
    animation = Tween<double>(begin: 0, end: 10.0).animate(controller)
      ..addListener(() {
        setState(() {
        // #docregion addListener
    // #enddocregion addListener
  Widget build(BuildContext context) {
    return Transform.rotate(angle: 0,
      child: Center(
        child: Container(
          child: Text("Rotation_Test"),
          height: 100,
          width: 100,
  void dispose() {

The error is due to the reason the direction of Text() widget is not defined.

To resolve the error specify the direction of Text() widget like LTR or RTL.

so replace the Text() widget as below to solve the error.

Text("Rotation_Test", textDirection: TextDirection.ltr)

output Image not found