-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: got most parts of code generation working; generating shitty code
- Loading branch information
Showing
12 changed files
with
592 additions
and
197 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
# Flutter dust generator | ||
|
||
Code generator for the Dart side of dust. | ||
Code generator for the Dart side of dust.open |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import 'package:dust/dust.dart'; | ||
|
||
part 'example.dust.dart'; | ||
|
||
@Model() | ||
class Todo with _$Todo { | ||
Todo._(); | ||
|
||
factory Todo({ | ||
required String title, | ||
String? description, | ||
@Dft(false) bool completed, | ||
}) = _Todo; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
// GENERATED CODE - DO NOT MODIFY BY HAND.dust | ||
|
||
part of 'example.dart'; | ||
|
||
// ************************************************************************** | ||
// DustGenerator | ||
// ************************************************************************** | ||
|
||
mixin _$Todo { | ||
$TodoRepository get $repository => const $TodoRepository(); | ||
|
||
Atom<String> get title$ => throw UnimplementedError(); | ||
String get title => title$.get(null); | ||
set title(String value) => title$.set(value); | ||
|
||
AtomOption<String> get description$ => throw UnimplementedError(); | ||
String? get description => description$.get(null); | ||
set description(String? value) => description$.set(value); | ||
|
||
Atom<bool> get completed$ => throw UnimplementedError(); | ||
bool get completed => completed$.get(null); | ||
set completed(bool value) => completed$.set(value); | ||
} | ||
|
||
class _Todo extends Todo { | ||
_Todo._(this.title$, this.description$, this.completed$) : super._(); | ||
|
||
factory _Todo({ | ||
required String title, | ||
String? description, | ||
bool completed = false, | ||
}) => | ||
$TodoRepository().create() as _Todo; | ||
|
||
@override | ||
final Atom<String> title$; | ||
|
||
@override | ||
final AtomOption<String> description$; | ||
|
||
@override | ||
final Atom<bool> completed$; | ||
} | ||
|
||
class $TodoRepository implements Repository<Todo> { | ||
const $TodoRepository(); | ||
|
||
static bool $init = false; | ||
|
||
Todo create() { | ||
final id = Dust.instance.randomId(); | ||
final node = get(id); | ||
$write(id); | ||
return node.get(null)!; | ||
} | ||
|
||
void $write(Id id) {} | ||
|
||
@override | ||
void delete(Todo model) { | ||
// TODO: implement delete | ||
} | ||
|
||
@override | ||
NodeOption<Todo> get(Id id) { | ||
// TODO: implement get | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
Id id(Todo model) { | ||
// TODO: implement id | ||
throw UnimplementedError(); | ||
} | ||
|
||
@override | ||
Schema init() { | ||
$init = true; | ||
return const Schema( | ||
stickyNodes: [], | ||
stickyAtoms: [], | ||
stickyEdges: [], | ||
acyclicEdges: [], | ||
); | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.