File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -327,8 +327,13 @@ class ChainBuilder {
327
327
});
328
328
});
329
329
330
- case IndexExpression ():
331
- _unwrapPostfix (expression.target! , (target) {
330
+ case IndexExpression (: var target? ):
331
+ // We check for a non-null target because the target may be `null` if
332
+ // the chain we are building is itself in a cascade section that begins
333
+ // with an index expression like:
334
+ //
335
+ // object..[index].chain();
336
+ _unwrapPostfix (target, (target) {
332
337
return _visitor.pieces.build (() {
333
338
_visitor.pieces.add (target);
334
339
_visitor.writeIndexExpression (expression);
Original file line number Diff line number Diff line change @@ -36,4 +36,8 @@ object..cascade()!..cascade()[index]..cascade()(arg);
36
36
object
37
37
..cascade()!
38
38
..cascade()[index]
39
- ..cascade()(arg);
39
+ ..cascade()(arg);
40
+ >>> Chain with index target.
41
+ object..[index].method();
42
+ <<<
43
+ object..[index].method();
You can’t perform that action at this time.
0 commit comments