Skip to content

Commit

Permalink
Merge pull request #244 from SayedZeeshanHyder/main
Browse files Browse the repository at this point in the history
Fixed Null
  • Loading branch information
SayedZeeshanHyder authored Jul 28, 2024
2 parents 8b3a39c + e745510 commit 5cf12a3
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions lib/new_ui/screens/AnnouncementScreen/announcementscreen.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ class AnnouncementScreen extends ConsumerStatefulWidget {
class _AnnouncementScreenState extends ConsumerState<AnnouncementScreen> {
final DateTime _lastDate = DateTime.now();

late StudentModel studentModel;
late StudentModel? studentModel;

@override
void initState() {
super.initState();
final UserModel? data = ref.read(userModelProvider);
setState(() {
studentModel = data!.studentModel!;
studentModel = data?.studentModel;
});
}

Expand Down Expand Up @@ -82,13 +82,17 @@ class _AnnouncementScreenState extends ConsumerState<AnnouncementScreen> {
return SizedBox();
}

if(studentModel==null && announcement.batch!.contains("All")){
return listTile;
}

//Condition if it is for all
if(announcement.batch!.contains("All")) {
return listTile;
}

//Condition if the student cannot see the Announcement
if(studentModel.branch != announcement.branch || studentModel.batch != announcement.batch || studentModel.div != announcement.div || studentModel.gradyear != announcement.gradYear) {
if(studentModel!.branch != announcement.branch || studentModel!.batch != announcement.batch || studentModel!.div != announcement.div || studentModel!.gradyear != announcement.gradYear) {
return SizedBox();
}

Expand Down

0 comments on commit 5cf12a3

Please sign in to comment.