average abstract method Null safety

Future<double?> average(
  1. num? selector(
    1. T object
    )
)

Computes the average of some ManagedObject property.

selector identifies the property being averaged, e.g.

    var query = Query<User>();
    var averageAge = await query.reduce.average((user) => user.age);

The property must be an attribute and its type must be an num, i.e. int or double.

Implementation

Future<double?> average(num? Function(T object) selector);