refactor (core <-> ui <-> persistence) with the new filter changes.

Signed-off-by: Sahil Kumar <[email protected]>
This commit is contained in:
Sahil Kumar
2021-04-27 15:41:00 +05:30
parent f683961581
commit 8c666caa52
24 changed files with 180 additions and 195 deletions
@@ -23,16 +23,16 @@ class ChannelModel {
this.memberCount = 0,
this.extraData,
this.team,
}) : config = config ?? ChannelConfig(),
createdAt = createdAt ?? DateTime.now(),
updatedAt = updatedAt ?? DateTime.now(),
assert(
}) : assert(
(cid != null && cid.contains(':')) || (id != null && type != null),
'provide either a cid or an id and type',
),
id = id ?? cid!.split(':')[1],
type = type ?? cid!.split(':')[0],
cid = cid ?? '$type:$id';
cid = cid ?? '$type:$id',
config = config ?? ChannelConfig(),
createdAt = createdAt ?? DateTime.now(),
updatedAt = updatedAt ?? DateTime.now();
/// Create a new instance from a json
factory ChannelModel.fromJson(Map<String, dynamic> json) =>
@@ -1,5 +1,7 @@
// ignore_for_file: non_constant_identifier_names, constant_identifier_names
import 'package:equatable/equatable.dart';
const _groupOperators = [
FilterOperator.and,
FilterOperator.or,
@@ -83,7 +85,7 @@ extension FilterOperatorX on FilterOperator {
/// )
/// ```
/// See <a href="https://getstream.io/chat/docs/query_channels/?language=dart" target="_top">Query Channels Documentation</a>
class Filter {
class Filter extends Equatable {
const Filter.__({
required this.operator,
required this.value,
@@ -171,6 +173,9 @@ class Filter {
///
final Object /*List<Object>|List<Filter>|String*/ value;
@override
List<Object?> get props => [operator, key, value];
///
Map<String, Object> toJson() {
final json = <String, Object>{};