@@ -161,13 +161,13 @@ class UpdateProfileBloc extends Bloc<UpdateProfileEvent, UpdateProfileState> {
161
161
for (final platform in platforms) {
162
162
final handle = controllers[platform]! .text.trim ();
163
163
164
- if (handle.isEmpty) continue ;
165
-
166
164
if (! compareHandles (platform, handle)) {
167
165
isChanged | = true ;
168
- final res = await UserRepository .verifyHandle (platform, handle);
166
+ if (handle.isNotEmpty) {
167
+ final res = await UserRepository .verifyHandle (platform, handle);
169
168
170
- if (! res) errors[platform] = 'Invalid Handle' ;
169
+ if (! res) errors[platform] = 'Invalid Handle' ;
170
+ }
171
171
}
172
172
}
173
173
@@ -209,19 +209,19 @@ class UpdateProfileBloc extends Bloc<UpdateProfileEvent, UpdateProfileState> {
209
209
bool compareHandles (String platform, String value) {
210
210
switch (platform) {
211
211
case 'codechef' :
212
- return value == state.user? .handle? .codechef;
212
+ return value. compareTo ( state.user? .handle? .codechef ?? '' ) == 0 ;
213
213
214
214
case 'codeforces' :
215
- return value == state.user? .handle? .codeforces;
215
+ return value. compareTo ( state.user? .handle? .codeforces ?? '' ) == 0 ;
216
216
217
217
case 'hackerrank' :
218
- return value == state.user? .handle? .hackerrank;
218
+ return value. compareTo ( state.user? .handle? .hackerrank ?? '' ) == 0 ;
219
219
220
220
case 'spoj' :
221
- return value == state.user? .handle? .spoj;
221
+ return value. compareTo ( state.user? .handle? .spoj ?? '' ) == 0 ;
222
222
223
223
case 'leetcode' :
224
- return value == state.user? .handle? .leetcode;
224
+ return value. compareTo ( state.user? .handle? .leetcode ?? '' ) == 0 ;
225
225
226
226
default :
227
227
return false ;
0 commit comments