Skip to content

Commit

Permalink
Fix npe
Browse files Browse the repository at this point in the history
  • Loading branch information
DimitarPetrov committed Feb 18, 2024
1 parent 6430092 commit c77382b
Show file tree
Hide file tree
Showing 7 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,5 +72,5 @@ dependencies {
testImplementation 'junit:junit:4.12'
androidTestImplementation 'androidx.test:runner:1.1.0-alpha4'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0-alpha4'
compile 'com.android.support:multidex:1.0.3'
implementation 'com.android.support:multidex:1.0.3'
}
2 changes: 1 addition & 1 deletion android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ buildscript {
}

dependencies {
classpath 'com.android.tools.build:gradle:4.2.0'
classpath 'com.android.tools.build:gradle:7.3.1'
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/screens/home.dart
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class HomeState extends State<Home> {
return null;
}

void _handleSubmitted(BuildContext context, Subject subject, String title,
void _handleSubmitted(BuildContext context, Subject? subject, String title,
String description) async {
updateModel(
context,
Expand Down
8 changes: 4 additions & 4 deletions lib/screens/subject_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,10 @@ class SubjectDetailsState extends State<SubjectDetails> {
return null;
}

void _handleEdit(BuildContext context, Subject subject, String title,
void _handleEdit(BuildContext context, Subject? subject, String title,
String description) async {
updateModel(context, (model) {
Subject s = model.subjects[model.subjects.indexOf(subject)];
Subject s = model.subjects[model.subjects.indexOf(subject!)];
if (title.isNotEmpty) {
s.title = title;
}
Expand All @@ -180,11 +180,11 @@ class SubjectDetailsState extends State<SubjectDetails> {
return null;
}

void _handleSubmitted(BuildContext context, Subject subject, String title,
void _handleSubmitted(BuildContext context, Subject? subject, String title,
String description) async {
updateModel(
context,
(model) => model.addTopic(subject,
(model) => model.addTopic(subject!,
new Topic(title: title, description: description, indexes: [])));
createDirs(title);
Navigator.pop(context);
Expand Down
4 changes: 2 additions & 2 deletions lib/screens/topic_details.dart
Original file line number Diff line number Diff line change
Expand Up @@ -230,10 +230,10 @@ class TopicDetailsState extends State<TopicDetails> {
return null;
}

void _handleEdit(BuildContext context, Subject subject, String title,
void _handleEdit(BuildContext context, Subject? subject, String title,
String description) async {
updateModel(context, (model) {
Subject s = model.subjects[model.subjects.indexOf(subject)];
Subject s = model.subjects[model.subjects.indexOf(subject!)];
Topic t = s.topics[s.topics.indexOf(widget.topic)];
if (title.isNotEmpty) {
String oldTitle = t.title;
Expand Down
4 changes: 2 additions & 2 deletions lib/widgets/add_topic_form.dart
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import 'package:study_snap/models/subject.dart';
typedef String? ValidateCallback(
BuildContext context, Subject? subject, String? value);
typedef void SubmitCallback(
BuildContext context, Subject subject, String title, String description);
BuildContext context, Subject? subject, String title, String description);

class AddTopicForm extends StatefulWidget {
final Subject? subject;
Expand Down Expand Up @@ -80,7 +80,7 @@ class AddTopicFormState extends State<AddTopicForm> {
if (form != null && form.validate()) {
form.save();
widget.handleSubmitted(
context, widget.subject!, title, description);
context, widget.subject, title, description);
}
},
),
Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ description: Flutter app for managing study materials in form of photos.
# In iOS, build-name is used as CFBundleShortVersionString while build-number used as CFBundleVersion.
# Read more about iOS versioning at
# https://developer.apple.com/library/archive/documentation/General/Reference/InfoPlistKeyReference/Articles/CoreFoundationKeys.html
version: 1.1.1+5
version: 1.1.1+6

environment:
sdk: ">=2.12.0 <3.0.0"
Expand Down

0 comments on commit c77382b

Please sign in to comment.