Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

flutter RTL syntax error with "package:intl/intl.dart"

Hi i recently try to use a date Picker for flutter and i didn't find any Doc or tutorial for it so i open flutter gallery project and try to copy code . as following the code i import "package:intl/intl.dart" library . after that in main.dart build function:

  Widget build(BuildContext context) {
return new MaterialApp(
    title: 'Welcome to Flutter',
    theme: new ThemeData.light(),
    home: new InitiateAppPage(),
    builder: (BuildContext context, Widget child) {
      return new Directionality(
        textDirection: TextDirection.rtl,
        child: child,
      );
    },
    );   }

Element 'TextDirection' from SDK library 'ui.dart' is implicitly hidden by 'intl.dart'. any solution for this problem?

like image 592
javad bat Avatar asked Apr 04 '18 09:04

javad bat


2 Answers

import the namespace as below and use the alias name

import 'package:intl/intl.dart' as intl;
like image 84
Shyju M Avatar answered Oct 13 '22 09:10

Shyju M


import 'dart:ui' as ui;

..

textDirection: ui.TextDirection.ltr, 
like image 32
Mhmoud Sabry Avatar answered Oct 13 '22 08:10

Mhmoud Sabry