Skip to content

Commit

Permalink
code refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
cp-ishita-g committed Dec 17, 2024
1 parent 50bca8a commit a02661f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 25 deletions.
3 changes: 1 addition & 2 deletions app/lib/ui/flow/space/join/join_space_view_model.dart
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class JoinSpaceViewNotifier extends StateNotifier<JoinSpaceViewState> {

Future<void> joinSpace() async {
try {
spaceService.joinSpace(state.spaceId);
spaceService.joinSpace(state.space?.id ?? '');
state = state.copyWith(verifying: false, spaceJoined: true, error: null);
} catch (error, stack) {
state = state.copyWith(error: error, verifying: false);
Expand Down Expand Up @@ -95,7 +95,6 @@ class JoinSpaceViewState with _$JoinSpaceViewState {
@Default(false) bool verifying,
@Default(false) bool spaceJoined,
@Default('') String invitationCode,
@Default('') String spaceId,
@Default(false) bool errorInvalidInvitationCode,
@Default(false) bool alreadySpaceMember,
Object? error,
Expand Down
24 changes: 1 addition & 23 deletions app/lib/ui/flow/space/join/join_space_view_model.freezed.dart
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ mixin _$JoinSpaceViewState {
bool get verifying => throw _privateConstructorUsedError;
bool get spaceJoined => throw _privateConstructorUsedError;
String get invitationCode => throw _privateConstructorUsedError;
String get spaceId => throw _privateConstructorUsedError;
bool get errorInvalidInvitationCode => throw _privateConstructorUsedError;
bool get alreadySpaceMember => throw _privateConstructorUsedError;
Object? get error => throw _privateConstructorUsedError;
Expand All @@ -40,7 +39,6 @@ abstract class $JoinSpaceViewStateCopyWith<$Res> {
{bool verifying,
bool spaceJoined,
String invitationCode,
String spaceId,
bool errorInvalidInvitationCode,
bool alreadySpaceMember,
Object? error,
Expand All @@ -65,7 +63,6 @@ class _$JoinSpaceViewStateCopyWithImpl<$Res, $Val extends JoinSpaceViewState>
Object? verifying = null,
Object? spaceJoined = null,
Object? invitationCode = null,
Object? spaceId = null,
Object? errorInvalidInvitationCode = null,
Object? alreadySpaceMember = null,
Object? error = freezed,
Expand All @@ -84,10 +81,6 @@ class _$JoinSpaceViewStateCopyWithImpl<$Res, $Val extends JoinSpaceViewState>
? _value.invitationCode
: invitationCode // ignore: cast_nullable_to_non_nullable
as String,
spaceId: null == spaceId
? _value.spaceId
: spaceId // ignore: cast_nullable_to_non_nullable
as String,
errorInvalidInvitationCode: null == errorInvalidInvitationCode
? _value.errorInvalidInvitationCode
: errorInvalidInvitationCode // ignore: cast_nullable_to_non_nullable
Expand Down Expand Up @@ -129,7 +122,6 @@ abstract class _$$JoinSpaceViewStateImplCopyWith<$Res>
{bool verifying,
bool spaceJoined,
String invitationCode,
String spaceId,
bool errorInvalidInvitationCode,
bool alreadySpaceMember,
Object? error,
Expand All @@ -153,7 +145,6 @@ class __$$JoinSpaceViewStateImplCopyWithImpl<$Res>
Object? verifying = null,
Object? spaceJoined = null,
Object? invitationCode = null,
Object? spaceId = null,
Object? errorInvalidInvitationCode = null,
Object? alreadySpaceMember = null,
Object? error = freezed,
Expand All @@ -172,10 +163,6 @@ class __$$JoinSpaceViewStateImplCopyWithImpl<$Res>
? _value.invitationCode
: invitationCode // ignore: cast_nullable_to_non_nullable
as String,
spaceId: null == spaceId
? _value.spaceId
: spaceId // ignore: cast_nullable_to_non_nullable
as String,
errorInvalidInvitationCode: null == errorInvalidInvitationCode
? _value.errorInvalidInvitationCode
: errorInvalidInvitationCode // ignore: cast_nullable_to_non_nullable
Expand All @@ -200,7 +187,6 @@ class _$JoinSpaceViewStateImpl implements _JoinSpaceViewState {
{this.verifying = false,
this.spaceJoined = false,
this.invitationCode = '',
this.spaceId = '',
this.errorInvalidInvitationCode = false,
this.alreadySpaceMember = false,
this.error,
Expand All @@ -217,9 +203,6 @@ class _$JoinSpaceViewStateImpl implements _JoinSpaceViewState {
final String invitationCode;
@override
@JsonKey()
final String spaceId;
@override
@JsonKey()
final bool errorInvalidInvitationCode;
@override
@JsonKey()
Expand All @@ -231,7 +214,7 @@ class _$JoinSpaceViewStateImpl implements _JoinSpaceViewState {

@override
String toString() {
return 'JoinSpaceViewState(verifying: $verifying, spaceJoined: $spaceJoined, invitationCode: $invitationCode, spaceId: $spaceId, errorInvalidInvitationCode: $errorInvalidInvitationCode, alreadySpaceMember: $alreadySpaceMember, error: $error, space: $space)';
return 'JoinSpaceViewState(verifying: $verifying, spaceJoined: $spaceJoined, invitationCode: $invitationCode, errorInvalidInvitationCode: $errorInvalidInvitationCode, alreadySpaceMember: $alreadySpaceMember, error: $error, space: $space)';
}

@override
Expand All @@ -245,7 +228,6 @@ class _$JoinSpaceViewStateImpl implements _JoinSpaceViewState {
other.spaceJoined == spaceJoined) &&
(identical(other.invitationCode, invitationCode) ||
other.invitationCode == invitationCode) &&
(identical(other.spaceId, spaceId) || other.spaceId == spaceId) &&
(identical(other.errorInvalidInvitationCode,
errorInvalidInvitationCode) ||
other.errorInvalidInvitationCode ==
Expand All @@ -262,7 +244,6 @@ class _$JoinSpaceViewStateImpl implements _JoinSpaceViewState {
verifying,
spaceJoined,
invitationCode,
spaceId,
errorInvalidInvitationCode,
alreadySpaceMember,
const DeepCollectionEquality().hash(error),
Expand All @@ -281,7 +262,6 @@ abstract class _JoinSpaceViewState implements JoinSpaceViewState {
{final bool verifying,
final bool spaceJoined,
final String invitationCode,
final String spaceId,
final bool errorInvalidInvitationCode,
final bool alreadySpaceMember,
final Object? error,
Expand All @@ -294,8 +274,6 @@ abstract class _JoinSpaceViewState implements JoinSpaceViewState {
@override
String get invitationCode;
@override
String get spaceId;
@override
bool get errorInvalidInvitationCode;
@override
bool get alreadySpaceMember;
Expand Down

0 comments on commit a02661f

Please sign in to comment.