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

Null check operator used on a null value #10

Open
LenzB1987 opened this issue Jul 9, 2023 · 2 comments
Open

Null check operator used on a null value #10

LenzB1987 opened this issue Jul 9, 2023 · 2 comments

Comments

@LenzB1987
Copy link

I keep on getting the error. I believe it comes from the video compress package

@EainHmunKhin
Copy link

EainHmunKhin commented Jul 10, 2023

In video.dart under models folder ,just add this

static Video fromSnap(DocumentSnapshot snap) {
var snapshot = snap.data() as Map<String, dynamic>;
return Video(
caption: snapshot['caption'] ?? '',
commentCount: snapshot['commentCount'] ?? 0 as int ,
id: snapshot['id'] ?? '',
likes: snapshot['likes'] ?? [] as List,
profilePhoto: snapshot['profilePhoto'] ?? '',
shareCount: snapshot['shareCount'] ?? 0 as int,
songName: snapshot['songName'] ?? '',
uid: snapshot['uid'] ?? '',
username: snapshot['username'] ?? '',
videoUrl: snapshot['videoUrl'] ?? '',
thumbnail: snapshot['thumbnail'] ?? '');
}
}

instead of this

static Video fromSnap(DocumentSnapshot snap) {
var snapshot = snap.data() as Map<String, dynamic>;

return Video(
username: snapshot['username'],
uid: snapshot['uid'],
id: snapshot['id'],
likes: snapshot['likes'],
commentCount: snapshot['commentCount'],
shareCount: snapshot['shareCount'],
songName: snapshot['songName'],
caption: snapshot['caption'],
videoUrl: snapshot['videoUrl'],
profilePhoto: snapshot['profilePhoto'],
thumbnail: snapshot['thumbnail'],
);
}
}

@DebjyotiKumarGupta
Copy link

Is it solved?

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