clear method

  1. @override
void clear({
  1. bool confirm = false,
  2. bool notify = true,
})
override

Removes all objects from this list and from the Realtime Database; the length of the list becomes zero. Setting confirm to true is required in order to call this function as a 'security' mesure.

Note that notify has no effect here and should not be used.

Implementation

@override
void clear({bool confirm = false, bool notify = true}) {
  assert(notify, 'Notify has no effect here and should not be used.');
  if (!confirm) {
    throw const ShouldNotCall(
        'You almost cleared the entire database ! Set the parameter confirm to true if that was really your intention.');
  }

  for (final item in this) {
    remove(item);
  }
}