```dart class MyApp extends StatefulWidget { const MyApp({Key? key}) : super(key: key); @override State createState() => _MyAppState(); } class _MyAppState extends State { StreamSubscription>? _stream; // A reference to the retrieved post late Post _post; @override void initState() { super.initState(); _configure(); } // Initialize the Amplify libraries and call `observeQuery` Future _configure() async { // ... } ... void observeQuery() { _stream = Amplify.DataStore.observeQuery( Post.classType, where: Post.ID.eq('123') ).listen((QuerySnapshot snapshot) { setState(() { _post = snapshot.items.first; }); }); } Future updatePost(String newTitle) async { final updatedPost = _post.copyWith(title: newTitle); await Amplify.DataStore.save(updatedPost); // you do not need to explicitly set _post here; observeQuery will see // the update and set the variable. } // Build function and UI elements ... @override void dispose() { _stream?.cancel(); super.dispose(); } } ```