getter function

Method getter(
  1. String name,
  2. String type, {
  3. bool isAbstract = true,
})

Implementation

Method getter(String name, String type, {bool isAbstract = true}) {
  return Method((m) => m
    ..name = name
    ..type = MethodType.getter
    ..returns = refer(type)
    ..body = isAbstract ? null : Code('return this.$name;'));
}