Update custom service generator

This commit is contained in:
Tobe O 2018-07-14 18:06:08 -04:00
parent 00075b07cd
commit 96f2955e94

View file

@ -12,13 +12,16 @@ class CustomServiceGenerator extends ServiceGenerator {
@override @override
void applyToLibrary(LibraryBuilder library, String name, String lower) { void applyToLibrary(LibraryBuilder library, String name, String lower) {
var clazz = new ClassBuilder('${name}Service', asExtends: new TypeBuilder('Service')); library.body.add(new Class((clazz) {
library.addMember(clazz); clazz
..name = '${name}Service'
..extend = refer('Service');
}));
} }
@override @override
ExpressionBuilder createInstance( Expression createInstance(
MethodBuilder methodBuilder, String name, String lower) { MethodBuilder methodBuilder, String name, String lower) {
return new TypeBuilder('${name}Service').newInstance([]); return refer('${name}Service').newInstance([]);
} }
} }