Skip to content

Instantly share code, notes, and snippets.

@ookami-kb
Created June 15, 2020 19:07
Show Gist options
  • Save ookami-kb/140afc52aca9758a7d543460252792c1 to your computer and use it in GitHub Desktop.
Save ookami-kb/140afc52aca9758a7d543460252792c1 to your computer and use it in GitHub Desktop.
class CreateThreadBloc extends BlocBase {
/// Title of the conversation
Stream<String> get title => _title.transform(emptyValidationTransformer);
final BehaviorSubject<String> _title = BehaviorSubject.seeded('');
/// Creates new message thread or updates existing one.
Future<Either<Exception, MessageThread>> submit() async {
Either<Exception, MessageThread> result;
if (initialThread == null) {
result = await _createThread();
} else {
result = await _updateThread();
}
return result;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment