Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

自定义文件名和类名 #52

Open
Xinboy opened this issue Oct 12, 2021 · 3 comments
Open

自定义文件名和类名 #52

Xinboy opened this issue Oct 12, 2021 · 3 comments

Comments

@Xinboy
Copy link

Xinboy commented Oct 12, 2021

目前as在文件命名上,如果是驼峰命名,整个文件会出现波浪纹。
警告类名为驼峰式;建议改为小写字母+‘_’;

但是我发现如果我的json文件名字为:小写字母+‘_’;那我类名与文件名是一致的。

希望能够添加命名配置,能够区分创建

@ethan-k9
Copy link

ethan-k9 commented Nov 3, 2021

本来我也是这么想的:joy::joy::joy::joy:,翻了下源码,meta里面可以配置className

/// example_class_name.json
{
  "@meta": {
    "className": "ExampleClassName"
  }
}

源码如下:

 //generated class name
      String? className = meta['className'] as String?;
      if (className == null || className.isEmpty) {
        className = fileName[0].toUpperCase() + fileName.substring(1);
      }

@ethan-k9
Copy link

ethan-k9 commented Nov 3, 2021

无奈,还是fork了一份,改了源码。按照上面处理,import "xxx.dart"会出问题~

@wendux
Copy link
Member

wendux commented Nov 15, 2021

meta里面也可以配置import

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants