简体   繁体   English

Dart库导入快捷方式

[英]Dart library import shortcuts

In cases where I have to import the main file from a library in dart I have to do: 如果我必须从dart库中导入主文件,我必须这样做:

import 'package:<package_name>/<package_name>.dart';

Is there a shorthand for doing this in Dart? 在Dart中有这样做的简写吗?

Something like 就像是

import 'package:<package_name>';

Cause mentioning the package name twice seems redundant. 因为提及包名两次似乎是多余的。

Seems redundant but there is no way around. 似乎多余,但没有办法解决。 The new "add import" quick fix makes this mostly a non-issue IMHO. 新的“添加导入”快速修复使这主要是一个非问题恕我直言。

  • DartEditor ctrl + 1 DartEditor ctrl + 1
  • WebStorm/IntelliJ ctrl + Enter WebStorm / IntelliJ ctrl + Enter

You have to wait until analyzing is done and a hint/warning (wiggled underline) is shown. 您必须等到分析完成并显示提示/警告(摆动下划线)。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM