Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

type 'Null' is not a subtype of type 'String' #16

Closed
utkarshshukla03 opened this issue Dec 13, 2022 · 5 comments
Closed

type 'Null' is not a subtype of type 'String' #16

utkarshshukla03 opened this issue Dec 13, 2022 · 5 comments

Comments

@utkarshshukla03
Copy link

utkarshshukla03 commented Dec 13, 2022

Error showing in debug console
E/flutter ( 9425): [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: type 'Null' is not a subtype of type 'String'
E/flutter ( 9425): #0 User.fromSnap
package:insta_clone/models/user.dart:26
E/flutter ( 9425): #1 AuthMethods.getUserDetails
package:insta_clone/resources/auth_methods.dart:19
E/flutter ( 9425):
E/flutter ( 9425): #2 UserProvider.refreshUser
package:insta_clone/providers/user_provider.dart:13
E/flutter ( 9425):
E/flutter ( 9425): #3 _ResponsiveLayoutState.addData
package:insta_clone/responsive/responsive_layout.dart:28
E/flutter ( 9425):

From user.dart
static User fromSnap(DocumentSnapshot snap) {
var snapshot = snap.data() as Map<String, dynamic>;
return User(
username: snapshot['username'],
uid: snapshot['uid'],
email: snapshot['email'],
photoUrl: snapshot['photoUrl'], (error putting here on ['photoUrl')
followers: snapshot['followers'],
following: snapshot['following'],
);
}

From auth_methods.dart
DocumentSnapshot documentSnapshot =
await _firestore.collection('users').doc(currentUser.uid).get();

return model.User.fromSnap(documentSnapshot); (error pointing here on fromSnap)

}
please help stuck here from last 1 week, i have tried solutions to solve that red screen problem, but after that it just showing cirular progess indicator, i have deleted users from database but after that too its showing errors.

@huutan3621
Copy link

I have the same problem too and don't know how to fix it

@utkarshshukla03
Copy link
Author

utkarshshukla03 commented Dec 22, 2022

I have the same problem too and don't know how to fix it

@huutan3621
Did you got solution?

@utkarshshukla03
Copy link
Author

@huutan3621 @RivaanRanawat
Please reply!!!!!

@utkarshshukla03
Copy link
Author

I have the same problem too and don't know how to fix it

@huutan3621 ????

@RivaanRanawat
Copy link
Owner

Same as #12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants