Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions controller/lib/data/stories.dart
Original file line number Diff line number Diff line change
@@ -1,30 +1,34 @@
import 'package:flutter/foundation.dart';
import 'package:monarch_definitions/monarch_definitions.dart';

final storiesSuffix = RegExp(r'_stories$');

class StoryGroup {
final String groupName;
final String _groupName;
final List<StoryId> stories;
final String groupKey;

String get groupName => _groupName.replaceFirst(storiesSuffix, '');

StoryGroup({
required this.groupName,
required String groupName,
required this.stories,
required this.groupKey,
});
}) : _groupName = groupName;

@override
bool operator ==(Object other) =>
identical(this, other) ||
other is StoryGroup &&
groupName == other.groupName &&
_groupName == other._groupName &&
listEquals(stories, other.stories);

@override
int get hashCode => groupName.hashCode ^ stories.hashCode;
int get hashCode => _groupName.hashCode ^ stories.hashCode;

StoryGroup copyWith({List<StoryId>? stories}) {
return StoryGroup(
groupName: groupName,
groupName: _groupName,
stories: stories ?? this.stories,
groupKey: groupKey,
);
Expand Down