diff --git a/lib/src/commands/service_generators/custom.dart b/lib/src/commands/service_generators/custom.dart index 7d1f7f90..a1de5f32 100644 --- a/lib/src/commands/service_generators/custom.dart +++ b/lib/src/commands/service_generators/custom.dart @@ -12,13 +12,16 @@ class CustomServiceGenerator extends ServiceGenerator { @override void applyToLibrary(LibraryBuilder library, String name, String lower) { - var clazz = new ClassBuilder('${name}Service', asExtends: new TypeBuilder('Service')); - library.addMember(clazz); + library.body.add(new Class((clazz) { + clazz + ..name = '${name}Service' + ..extend = refer('Service'); + })); } @override - ExpressionBuilder createInstance( + Expression createInstance( MethodBuilder methodBuilder, String name, String lower) { - return new TypeBuilder('${name}Service').newInstance([]); + return refer('${name}Service').newInstance([]); } }