Skip to content

Commit

Permalink
Use fromIndex/toIndex for parameter names
Browse files Browse the repository at this point in the history
  • Loading branch information
nielsenko committed Nov 16, 2022
1 parent 8f23ede commit 1c40bcd
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions lib/src/list.dart
Original file line number Diff line number Diff line change
Expand Up @@ -145,9 +145,9 @@ class ManagedRealmList<T extends Object?> with RealmEntity, ListMixin<T> impleme
return result;
}

/// Move the element at [from] to [to].
void move(int oldIndex, int newIndex) {
realmCore.listMoveElement(handle, oldIndex, newIndex);
/// Move the element at [fromIndex] to [toIndex].
void move(int fromIndex, int toIndex) {
realmCore.listMoveElement(handle, fromIndex, toIndex);
}

/// Removes all objects from this list; the length of the list becomes zero.
Expand Down Expand Up @@ -334,16 +334,16 @@ class ListNotificationsController<T extends Object?> extends NotificationsContro
}

extension ListExtension<T> on List<T> {
/// Move the element at [from] to [to].
void move(int from, int to) {
RangeError.checkValidIndex(from, this, 'from', length);
RangeError.checkValidIndex(to, this, 'to', length);
if (to == from) return; // no-op
/// Move the element at [fromIndex] to [toIndex].
void move(int fromIndex, int toIndex) {
RangeError.checkValidIndex(fromIndex, this, 'from', length);
RangeError.checkValidIndex(toIndex, this, 'to', length);
if (toIndex == fromIndex) return; // no-op
final self = this;
if (self is ManagedRealmList<T>) {
self.move(from, to);
self.move(fromIndex, toIndex);
} else {
insert(to, removeAt(from));
insert(toIndex, removeAt(fromIndex));
}
}
}

0 comments on commit 1c40bcd

Please sign in to comment.