code_gen.dart 1003 B

123456789101112131415161718192021222324252627282930313233
  1. /// Auto gen code from rust ast, do not edit
  2. part of 'dispatch.dart';
  3. class UserEventSignIn {
  4. UserSignInParams payload;
  5. UserEventSignIn(this.payload);
  6. Future<Either<UserSignInResult, FlowyError>> send() {
  7. var request = FFIRequest.create()..event = UserEvent.SignIn.toString();
  8. return protobufToBytes(payload).fold(
  9. (payload) {
  10. request.payload = payload;
  11. return Dispatch.asyncRequest(request).then((response) {
  12. try {
  13. if (response.code != FFIStatusCode.Ok) {
  14. return right(FlowyError.from(response));
  15. } else {
  16. final pb = UserSignInResult.fromBuffer(response.payload);
  17. return left(pb);
  18. }
  19. } catch (e, s) {
  20. final error =
  21. FlowyError.fromError('${e.runtimeType}. Stack trace: $s');
  22. return right(error);
  23. }
  24. });
  25. },
  26. (err) => Future(() {
  27. return right(FlowyError.fromError(err));
  28. }),
  29. );
  30. }
  31. }