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 {
327327 });
328328 });
329329
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) {
332337 return _visitor.pieces.build (() {
333338 _visitor.pieces.add (target);
334339 _visitor.writeIndexExpression (expression);
Original file line number Diff line number Diff line change @@ -36,4 +36,8 @@ object..cascade()!..cascade()[index]..cascade()(arg);
3636object
3737 ..cascade()!
3838 ..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