Data Model
class DataModel {
Book? book;
DataModel({
this.book,
});
}
class Book {
String author;
Book({
required this.author,
});
}
Getx Controller
class BookController extends GetxController{
var dataModel = DataModel().obs;
updateAuthor(){
dataModel.value.book!.author = "";
}
}
While updating author Getx throwing " null checked used on a null value"
After changing the function to this
updateAuthor(){
dataModel.value.book?.author = "";
}
It is not updating the value, making it null.
Also tried with update method unable to update the value with this type of data model.Class inside class.
I am just trying to update the author but unable to do it.