flutter RTL syntax error with “package:intl/intl.dart”

ⅰ亾dé卋堺 提交于 2020-12-08 05:47:08

问题


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?


回答1:


import the namespace as below and use the alias name

import 'package:intl/intl.dart' as intl;



回答2:


import 'dart:ui' as ui;

..

textDirection: ui.TextDirection.ltr, 


来源:https://stackoverflow.com/questions/49647795/flutter-rtl-syntax-error-with-packageintl-intl-dart

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!