Skip to content

Commit 5e866d4

Browse files
authored
Revert IndexError deprecation change to maintain backwards compatibility (#249)
1 parent 737fcc5 commit 5e866d4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

lib/src/values/logic_value.dart

+6-4
Original file line numberDiff line numberDiff line change
@@ -448,10 +448,12 @@ abstract class LogicValue {
448448
LogicValue operator [](int index) {
449449
final modifiedIndex = (index < 0) ? width + index : index;
450450
if (modifiedIndex >= width || modifiedIndex < 0) {
451-
throw IndexError.withLength(index, width,
452-
indexable: this,
453-
name: 'LogicValueIndexOutOfRange',
454-
message: 'Index out of range: $modifiedIndex(=$index).');
451+
// The suggestion in the deprecation for this constructor is not available
452+
// before 2.19, so keep it in here for now. Eventually, switch to the
453+
// new one.
454+
// ignore: deprecated_member_use
455+
throw IndexError(index, this, 'LogicValueIndexOutOfRange',
456+
'Index out of range: $modifiedIndex(=$index).', width);
455457
}
456458
return _getIndex(modifiedIndex);
457459
}

0 commit comments

Comments
 (0)