SetKeyStream<T> constructor

SetKeyStream<T>({
  1. required T? convert(
    1. AtKey key,
    2. AtValue value
    ),
  2. String? regex,
  3. String? sharedBy,
  4. String? sharedWith,
  5. bool shouldGetKeys = true,
  6. String generateRef(
    1. AtKey key,
    2. AtValue value
    )?,
  7. FutureOr<void> onError(
    1. Object exception, [
    2. StackTrace? stackTrace
    ])?,
  8. AtClientManager? atClientManager,
})

Create a SetKeyStream instance

Pass the convert callback function to define how an AtKey and AtValue will converted into elements of the set. To filter AtKeys that will be included in the set, you may apply a custom regex filter, or pass in sharedBy and/or sharedWith atSigns. By default shouldGetKeys is enabled, which will initially populate the set with available keys that match the regex, sharedBy, and sharedWith filters. To control how the stream indexes the keys internally, you may pass a generateRef function which takes an AtKey and AtValue and returns the associated ref used for indexing (by default this is AtKey.key). You may also override the atClientManager if necessary.

Implementation

SetKeyStream({
  required T? Function(AtKey key, AtValue value) convert,
  String? regex,
  String? sharedBy,
  String? sharedWith,
  bool shouldGetKeys = true,
  String Function(AtKey key, AtValue value)? generateRef,
  FutureOr<void> Function(Object exception, [StackTrace? stackTrace])?
      onError,
  AtClientManager? atClientManager,
}) : super(
        convert: convert,
        regex: regex,
        shouldGetKeys: shouldGetKeys,
        sharedBy: sharedBy,
        sharedWith: sharedWith,
        generateRef: generateRef,
        castTo: (values) => castTo<T>(values),
        onError: onError,
        atClientManager: atClientManager,
      );