dart_style
dart_style copied to clipboard
Request for a publish of the npm package version with null safety
Hi I am a typescript developer writing ts code to generate dart code and use the dart-style
package to format the output. I notice the version is published two years ago with 1.3.2-dev
. I compare this version with the latest dart format
command and it will throw an error for a null safety scenario. The example code snippet is as following.
Comment.fromJson(Map<String, dynamic> json)
: id = json['id'],
_post = json['post'] != null
// I add a ? after json['post']
? Post.fromJson(new Map<String, dynamic>.from(json['post']?['serializedData']))
: null,
_content = json['content'];
This will throw this error
Could not format because the source could not be parsed:
line 99, column 88: Expected to find ':'.
╷
99 │ ? Post.fromJson(new Map<String, dynamic>.from((json['post'])?['serializedData']))
│ ^
╵
line 99, column 88: Expected an identifier.
╷
99 │ ? Post.fromJson(new Map<String, dynamic>.from((json['post'])?['serializedData']))
│ ^
╵
If I use dart format
instead there is no error. I guess it is because the outdated version for npm package.
The dart version package is 2.0+ but the npm one is not. It would be much better if you could update the npm package as well with null safety features. Thanks for the help!
Hey, @jacob314, do you remember anything about publishing dart_style to NPM? I've never done this and barely remember anything about when you first rolled in support for it.
Sorry, but we don't support publishing dart_style to NPM anymore. The one person on the team who knew how that worked is no longer on the team. You are certainly welcome to compile dart_style to JS yourself and use it, but we don't have the capacity to support the NPM package ourselves anymore. Sorry.