FirebaseListProvided<T> class
abstract
A ListProvided that automagically saves all of its into Firebase's Realtime Database, and notifies of changes made in real time.
Written by: @Guibi1
- Inheritance
-
- Object
- Iterable<
T> - ListSerializable<
T> - ListProvided<
T> - DatabaseListProvided<
T> - FirebaseListProvided
- Available extensions
Constructors
- FirebaseListProvided({required String pathToData, String? pathToAvailableDataIds})
- Creates a FirebaseListProvided with the specified data path and ids path.
Properties
- first → T
-
The first element.
no setterinherited
- firstOrNull → T?
-
Available on Iterable<
The first element of this iterator, orT> , provided by the IterableExtensions extensionnull
if the iterable is empty.no setter - hashCode → int
-
The hash code for this object.
no setterinherited
- hasListeners → bool
-
Whether any listeners are currently registered.
no setterinherited
-
indexed
→ Iterable<
(int, T)> -
Available on Iterable<
Pairs of elements of the indices and elements of this iterable.T> , provided by the IterableExtensions extensionno setter - isEmpty → bool
-
Whether this collection has no elements.
no setterinherited
- isNotEmpty → bool
-
Whether this collection has at least one element.
no setterinherited
-
iterator
→ Iterator<
T> -
A new
Iterator
that allows iterating the elements of thisIterable
.no setterinherited - last → T
-
The last element.
no setterinherited
- lastOrNull → T?
-
Available on Iterable<
The last element of this iterable, orT> , provided by the IterableExtensions extensionnull
if the iterable is empty.no setter - length → int
-
The number of elements in this Iterable.
no setterinherited
-
nonNulls
→ Iterable<
T> -
Available on Iterable<
The non-T?> , provided by the NullableIterableExtensions extensionnull
elements of this iterable.no setter - pathToAvailableDataIds ↔ String
-
The path to the list of available ids inside the database.
getter/setter pair
- pathToData → String
-
The path to the stored data inside the database.
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- single → T
-
Checks that this iterable has only one element, and returns that element.
no setterinherited
- singleOrNull → T?
-
Available on Iterable<
The single element of this iterator, orT> , provided by the IterableExtensions extensionnull
.no setter -
wait
→ Future<
List< T> > -
Available on Iterable<
Waits for futures in parallel.Future< , provided by the FutureIterable extensionT> >no setter
Methods
-
add(
T item, {bool notify = true}) → void -
Adds an item to the Realtime Database.
override
-
addListener(
VoidCallback listener) → void -
Register a closure to be called when the object changes.
inherited
-
any(
bool test(T element)) → bool -
Checks whether any element of this iterable satisfies
test
.inherited -
asNameMap(
) → Map< String, T> -
Available on Iterable<
Creates a map from the names of enum values to the values.T> , provided by the EnumByName extension -
byName(
String name) → T -
Available on Iterable<
Finds the enum value in this list with nameT> , provided by the EnumByName extensionname
. -
cast<
R> () → Iterable< R> -
A view of this iterable as an iterable of
R
instances.inherited -
clear(
{bool confirm = false, bool notify = true}) → void -
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.override -
contains(
Object? element) → bool -
Whether the collection contains an element equal to
element
.inherited -
deserialize(
dynamic map) → void -
You can't use this function with DatabaseListProvided, as it already saves its content in the cloud automagically.
inherited
-
deserializeItem(
dynamic data) → T -
Returns a new
T
from the provided serialized data.inherited -
dispose(
) → void -
Discards any resources used by the object. After this is called, the
object is not in a usable state and should be discarded (calls to
addListener will throw after the object is disposed).
inherited
-
elementAt(
int index) → T -
Returns the
index
th element.inherited -
elementAtOrNull(
int index) → T? -
Available on Iterable<
The element at positionT> , provided by the IterableExtensions extensionindex
of this iterable, ornull
. -
every(
bool test(T element)) → bool -
Checks whether every element of this iterable satisfies
test
.inherited -
expand<
T> (Iterable< T> toElements(T element)) → Iterable<T> -
Expands each element of this Iterable into zero or more elements.
inherited
-
firstWhere(
bool test(T element), {T orElse()?}) → T -
The first element that satisfies the given predicate
test
.inherited -
fold<
T> (T initialValue, T combine(T previousValue, T element)) → T -
Reduces a collection to a single value by iteratively combining each
element of the collection with an existing value
inherited
-
followedBy(
Iterable< T> other) → Iterable<T> -
Creates the lazy concatenation of this iterable and
other
.inherited -
forceNotify(
) → void -
If for some reason one needs to call notifier, they can call forceNotify
inherited
-
forEach(
void action(T element)) → void -
Invokes
action
on each element of this iterable in iteration order.inherited -
fromId(
String id) → T -
Return the element with specified
id
.inherited -
indexWhere(
bool test(T element), [int start = 0]) → int -
The first index in the list that satisfies the provided
test
.inherited -
join(
[String separator = ""]) → String -
Converts each element to a String and concatenates the strings.
inherited
-
lastWhere(
bool test(T element), {T orElse()?}) → T -
The last element that satisfies the given predicate
test
.inherited -
map<
T> (T toElement(T e)) → Iterable< T> -
This is a simple interface to the map method of the list
inherited
-
move(
int oldIndex, int newIndex, {bool notify = true}) → void -
Moves an item from one position to another
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
notifyListeners(
) → void -
Call all the registered listeners.
inherited
-
reduce(
T combine(T value, T element)) → T -
Reduces a collection to a single value by iteratively combining elements
of the collection using the provided function.
inherited
-
remove(
dynamic value, {bool notify = true}) → void -
Removes an item from the Realtime Database.
override
-
removeListener(
VoidCallback listener) → void -
Remove a previously registered closure from the list of closures that are
notified when the object changes.
inherited
-
replace(
T item, {bool notify = true}) → void -
Replaces the current item by
item
in the Realtime Database. The item to replace is identified by its id.override -
serialize(
) → Map< String, dynamic> -
Serializes all of its items into a single map, separted by their id.
inherited
-
singleWhere(
bool test(T element), {T orElse()?}) → T -
The single element that satisfies
test
.inherited -
skip(
int count) → Iterable< T> -
Creates an Iterable that provides all but the first
count
elements.inherited -
skipWhile(
bool test(T value)) → Iterable< T> -
Creates an
Iterable
that skips leading elements whiletest
is satisfied.inherited -
take(
int count) → Iterable< T> -
Creates a lazy iterable of the
count
first elements of this iterable.inherited -
takeWhile(
bool test(T value)) → Iterable< T> -
Creates a lazy iterable of the leading elements satisfying
test
.inherited -
toList(
{bool growable = true}) → List< T> -
Creates a List containing the elements of this Iterable.
inherited
-
toSet(
) → Set< T> -
Creates a Set containing the same elements as this iterable.
inherited
-
toString(
) → String -
Returns a string representation of (some of) the elements of
this
.inherited -
where(
bool test(T element)) → Iterable< T> -
Creates a new lazy Iterable with all elements that satisfy the
predicate
test
.inherited -
whereType<
T> () → Iterable< T> -
Creates a new lazy Iterable with all elements that have type
T
.inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
-
operator [](
dynamic value) → T -
Returns the item at the location specified by
value
.inherited -
operator []=(
dynamic value, T item) → void -
You can't not use this function with FirebaseListProvided in case the ids of the provided values dont match.
Use the function replace intead.
override