Skip to content

Commit

Permalink
Allow invalid code to be shown
Browse files Browse the repository at this point in the history
  • Loading branch information
javiercbk committed Aug 25, 2018
1 parent d064abb commit 9fc4c22
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
"configurations": [
{
"name": "generate_bug_10",
"program": "${workspaceFolder}/example/generate_bug_10.dart",
"program": "${workspaceFolder}/example/generate_model_example.dart",
"request": "launch",
"type": "dart"
},
Expand Down
8 changes: 7 additions & 1 deletion lib/model_generator.dart
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,12 @@ class ModelGenerator {
final Map<String, dynamic> jsonRawData = decodeJSON(rawJson);
_generateClassDefinition(_rootClassName, jsonRawData);
final formatter = new DartFormatter();
return formatter.format(allClasses.map((c) => c.toString()).join('\n'));
final unformattedDart = allClasses.map((c) => c.toString()).join('\n');
try {
final formatted = formatter.format(unformattedDart);
return formatted;
} catch (e) {
return unformattedDart;
}
}
}
1 change: 0 additions & 1 deletion lib/syntax.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import './helpers.dart';


class TypeDefinition {
String name;
String subtype;
Expand Down

0 comments on commit 9fc4c22

Please sign in to comment.