I’m new to Flutter, how do I update certain objects/columns (not all columns)?
the table/entity class:
@Entity()
class Customer {
int id;
final String name;
final String city;
Customer ({this.id = 0, name= "", this.city = ""});
}
let say…i want update
id=1,name=”john”,city=”New York”
to
id=1,name=”john”,city=”Tokyo”
the code:
String strInput = ["1", "Tokyo"];
List Lstr = (strInput).split(",");
int idUpdate = int.tryParse(Lstr [0]) ?? 0;
if (idUpdate > 0) {
customerBox.put(Customer(
id: idUpdate, city: Lstr [1]));
}
the result = column ‘name’ filled with initial values :
id=1,name=””,city=”Tokyo”
thank you
New contributor
0