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

Fix/Builder #32

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 4.2.3

- builder fix

## 4.2.2

- update dependencies
Expand Down
8 changes: 5 additions & 3 deletions lib/builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,9 +81,11 @@ class YamlBasedBuilder implements Builder {
var dartContent = generateDartContentFromYaml(objectName, contents);

try {
final version = Platform.version;
final formatter = DartFormatter(languageVersion: Version.parse(version));
dartContent = formatter.format(dartContent);
final versionRegexp = RegExp(r"\d+\.\d+\.\d+");
final match = versionRegexp.firstMatch(Platform.version)!;
dartContent = DartFormatter(
languageVersion: Version.parse(Platform.version.substring(match.start, match.end))
).format(dartContent);
} on FormatterException {
log.warning(
'Could not format generated output, it might contain errors.',
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name: i18n
description: Simple i18n solution for dart and flutter. Uses code generation to generate translations as dart classes. Efficient and works with autocomplete!
version: 4.2.2
version: 4.2.3
homepage: https://github.com/MohiuddinM/i18n

environment:
Expand Down
Loading