This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
v2.2.0
-
Imports are prefixed with
_i1
rather than_1
which satisfies the lint
lowercase_with_underscores
. While not a strictly breaking change you may
have to fix/regenerate golden file-like tests. We added documentation that
the specific prefix is not considered stable. -
Added
Expression.index
for accessing the[]
operator:
void main() {
test('should emit an index operator', () {
expect(
refer('bar').index(literalTrue).assignVar('foo').statement,
equalsDart('var foo = bar[true];'),
);
} );
test('should emit an index operator set', () {
expect(
refer('bar')
.index(literalTrue)
.assign(literalFalse)
.assignVar('foo')
.statement,
equalsDart('var foo = bar[true] = false;'),
);
});
}
-
literalList
accepts anIterable
argument. -
Fixed an NPE when a method had a return type of a
FunctionType
:
void main() {
test('should create a method with a function type return type', () {
expect(
new Method((b) => b
..name = 'foo'
..returns = new FunctionType((b) => b
..returnType = refer('String')
..requiredParameters.addAll([
refer('int'),
]))),
equalsDart(r'''
String Function(int) foo();
'''),
);
});
}