Repository: PTLam-Thryve/quizlet_clone
Pull request #33: Adjustment to the Flashcard
Author: login: Megadebt
Labels: name: enhancement
description: New feature or request
name: Review effort 2/5
Created: 2025-04-02T17:08:49Z | Merged: 2025-04-10T18:45:54Z

### **User description**
Adjusted the flashcard model to include a **setId** property, aka the ID of the flashcardset it belongs to.


___

### **PR Type**
Enhancement, Bug fix


___

### **Description**
- Added `setId` property to the `Flashcard` model.

- Updated `FlashCardService` methods to handle `setId`.

- Fixed navigation issues after creating or editing flashcard sets.

- Resolved naming inconsistencies in `FlashCardService`.


___



### **Changes walkthrough** 📝
<table><thead><tr><th></th><th align="left">Relevant files</th></tr></thead><tbody><tr><td><strong>Enhancement</strong></td><td><table>
<tr>
  <td>
    <details>
      <summary><strong>flashcard_service.dart</strong><dd><code>Enhance `FlashCardService` with `setId` support</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

lib/data/flashcard_service.dart

<li>Added <code>setId</code> handling in flashcard-related methods.<br> <li> Fixed naming inconsistencies in method parameters.<br> <li> Improved return values to include <code>setId</code>.


</details>


  </td>
  <td><a href="https://github.com/PTLam-Thryve/quizlet_clone/pull/33/files#diff-24350442dd1d093581953f485fd4c1c4014856d3bacd15f8a41aca9ed923373d">+21/-10</a>&nbsp; </td>

</tr>

<tr>
  <td>
    <details>
      <summary><strong>flashcard.dart</strong><dd><code>Add `setId` property to `Flashcard` model</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

lib/models/flashcard.dart

<li>Added <code>setId</code> property to the <code>Flashcard</code> model.<br> <li> Updated comments for clarity on <code>id</code> and <code>setId</code>.


</details>


  </td>
  <td><a href="https://github.com/PTLam-Thryve/quizlet_clone/pull/33/files#diff-608ff325dca603d1cfed489c8a77a01353911bf9d483ac810ef417cd5efed7e9">+3/-1</a>&nbsp; &nbsp; &nbsp; </td>

</tr>
</table></td></tr><tr><td><strong>Bug fix</strong></td><td><table>
<tr>
  <td>
    <details>
      <summary><strong>create_flash_card_set_page.dart</strong><dd><code>Fix navigation after creating flashcard set</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

lib/ui/pages/create_flash_card_set_page.dart

<li>Fixed navigation to home page after creating a flashcard set.<br> <li> Added <code>Navigator.pop()</code> before navigating to home.


</details>


  </td>
  <td><a href="https://github.com/PTLam-Thryve/quizlet_clone/pull/33/files#diff-20ece5abb63e0fe370b4a84953611ff62e68b80f35e9d0c78683449105e06bff">+1/-0</a>&nbsp; &nbsp; &nbsp; </td>

</tr>

<tr>
  <td>
    <details>
      <summary><strong>edit_flash_card_set_page.dart</strong><dd><code>Fix navigation after editing flashcard set</code>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </dd></summary>
<hr>

lib/ui/pages/edit_flash_card_set_page.dart

<li>Fixed navigation to home page after editing a flashcard set.<br> <li> Added <code>Navigator.pop()</code> before navigating to home.


</details>


  </td>
  <td><a href="https://github.com/PTLam-Thryve/quizlet_clone/pull/33/files#diff-8f37427b904bd778279a189caaef3fede1d229c0dcebb0a8a8ea960828aa662a">+1/-0</a>&nbsp; &nbsp; &nbsp; </td>

</tr>
</table></td></tr></tr></tbody></table>

___

> <details> <summary>  Need help?</summary><li>Type <code>/help how to ...</code> in the comments thread for any questions about Qodo Merge usage.</li><li>Check out the <a href="https://qodo-merge-docs.qodo.ai/usage-guide/">documentation</a> for more information.</li></details>


Diff:
diff --git a/ios/Podfile.lock b/ios/Podfile.lock
index 7f910df..e119f7f 100644
--- a/ios/Podfile.lock
+++ b/ios/Podfile.lock
@@ -1372,10 +1372,10 @@ EXTERNAL SOURCES:
 SPEC CHECKSUMS:
   abseil: d121da9ef7e2ff4cab7666e76c5a3e0915ae08c3
   BoringSSL-GRPC: ca6a8e5d04812fce8ffd6437810c2d46f925eaeb
-  cloud_firestore: 9aa00dac1dc5d3cc93c8cb6515056b038779e06a
+  cloud_firestore: f02547e5b28138821eb44a48e3c5f034ebb5411b
   Firebase: 374a441a91ead896215703a674d58cdb3e9d772b
-  firebase_auth: 6cbe1bbb3f3592892811735eb49b338950ecd803
-  firebase_core: 2337982fb78ee4d8d91e608b0a3d4f44346a93c8
+  firebase_auth: 1623c3c0b4d587c35f795181b83aacff03099b84
+  firebase_core: feb37e79f775c2bd08dd35e02d83678291317e10
   FirebaseAppCheckInterop: f23709c9ce92d810aa53ff4ce12ad3e666a3c7be
   FirebaseAuth: 0304982cfe00df8d49bf533bc4becd3de36c7122
   FirebaseAuthInterop: ac22ed402c2f4e3a8c63ebd3278af9a06073c1be
@@ -1396,4 +1396,4 @@ SPEC CHECKSUMS:
 
 PODFILE CHECKSUM: a57f30d18f102dd3ce366b1d62a55ecbef2158e5
 
-COCOAPODS: 1.15.2
+COCOAPODS: 1.16.2
diff --git a/lib/data/flashcard_service.dart b/lib/data/flashcard_service.dart
index e6dba00..7662ecb 100644
--- a/lib/data/flashcard_service.dart
+++ b/lib/data/flashcard_service.dart
@@ -4,11 +4,11 @@ import 'package:quizlet_clone/models/flashcard.dart';
 class FlashCardService {
   final FirebaseFirestore _fireStore = FirebaseFirestore.instance;
 
-  Future<List<Flashcard>> getFlashcards(final String flashCardSetid) async {
+  Future<List<Flashcard>> getFlashcards(final String flashCardSetId) async {
     try {
       final getFromCollection = await _fireStore
           .collection('flashcard-sets')
-          .doc(flashCardSetid)
+          .doc(flashCardSetId)
           .collection('flashcards')
           .get();
       final flashcards = getFromCollection.docs.map((doc) {
@@ -17,7 +17,11 @@ class FlashCardService {
             : '';
         final answer =
             doc.data().containsKey('answer') ? doc['answer'].toString() : '';
-        return Flashcard(answer: answer, question: question, id: doc.id);
+        return Flashcard(
+            answer: answer,
+            question: question,
+            id: doc.id,
+            setId: flashCardSetId);
       }).toList();
       return flashcards;
     } on FirebaseException catch (error) {
@@ -44,6 +48,7 @@ class FlashCardService {
         id: addedFlashcard.id,
         question: question,
         answer: answer,
+        setId: flashCardSetId,
       );
     } on FirebaseException catch (error) {
       throw FlashCardServiceException.fromFirebaseException(error);
@@ -68,7 +73,8 @@ class FlashCardService {
         'answer': newAnswer,
       });
       return Flashcard(
-        id: flashCardSetId,
+        id: flashCardId,
+        setId: flashCardSetId,
         question: newQuestion,
         answer: newAnswer,
       );
@@ -85,13 +91,18 @@ class FlashCardService {
     required String flashcardSetId,
     required String flashcardId,
   }) async {
-    try{
+    try {
       var flashcardCollection = _fireStore
-        .collection('flashcard-sets')
-        .doc(flashcardSetId)
-        .collection('flashcards');
-    await flashcardCollection.doc(flashcardId).delete();
-    return Flashcard(id: flashcardSetId, question: question, answer: answer);
+          .collection('flashcard-sets')
+          .doc(flashcardSetId)
+          .collection('flashcards');
+      await flashcardCollection.doc(flashcardId).delete();
+      return Flashcard(
+        id: flashcardId,
+        setId: flashcardSetId,
+        question: question,
+        answer: answer,
+      );
     } on FirebaseException catch (error) {
       throw FlashCardServiceException.fromFirebaseException(error);
     } catch (error) {
diff --git a/lib/models/flashcard.dart b/lib/models/flashcard.dart
index eff59f4..75776ea 100644
--- a/lib/models/flashcard.dart
+++ b/lib/models/flashcard.dart
@@ -3,8 +3,10 @@ class Flashcard {
     required this.id,
     required this.question,
     required this.answer,
+    required this.setId,
   });
-  final String id;//id of the set it belongs to aka FlashcardSetId
+  final String id;//id of a singular flashcard
   final String question;
   final String answer;
+  final String setId; //id of the set
 }
diff --git a/lib/ui/pages/create_flash_card_set_page.dart b/lib/ui/pages/create_flash_card_set_page.dart
index cfb8445..c0d7aad 100644
--- a/lib/ui/pages/create_flash_card_set_page.dart
+++ b/lib/ui/pages/create_flash_card_set_page.dart
@@ -5,7 +5,6 @@ import 'package:provider/provider.dart';
 import 'package:quizlet_clone/bloc/create_bloc/create_flash_card_set_form_bloc.dart';
 import 'package:quizlet_clone/bloc/create_bloc/create_flash_card_set_form_bloc_state.dart';
 import 'package:quizlet_clone/ui/constants/app_texts.dart';
-import 'package:quizlet_clone/ui/router/app_router.dart';
 import 'package:quizlet_clone/ui/utils/show_app_snack_bar.dart';
 import 'package:quizlet_clone/ui/widgets/forms/flash_card_set_form.dart';
 import 'package:quizlet_clone/ui/widgets/loading_overlay.dart';
@@ -47,7 +46,7 @@ class _CreateFlashCardPageState extends State<CreateFlashCardSetPage> {
           message: AppTexts.createSuccess,
           status: SnackBarStatus.success,
         );
-        unawaited(Navigator.of(context).pushReplacementNamed(RouteNames.home));
+        Navigator.of(context).pop();
       case CreateFlashCardErrorState errorState:
         showAppSnackBar(
           context,
diff --git a/lib/ui/pages/edit_flash_card_set_page.dart b/lib/ui/pages/edit_flash_card_set_page.dart
index 603180d..18d9443 100644
--- a/lib/ui/pages/edit_flash_card_set_page.dart
+++ b/lib/ui/pages/edit_flash_card_set_page.dart
@@ -5,7 +5,6 @@ import 'package:provider/provider.dart';
 import 'package:quizlet_clone/bloc/edit_bloc/edit_flash_card_bloc.dart';
 import 'package:quizlet_clone/bloc/edit_bloc/edit_flash_card_bloc_state.dart';
 import 'package:quizlet_clone/ui/constants/app_texts.dart';
-import 'package:quizlet_clone/ui/router/app_router.dart';
 import 'package:quizlet_clone/ui/utils/show_app_snack_bar.dart';
 import 'package:quizlet_clone/ui/widgets/forms/flash_card_set_form.dart';
 import 'package:quizlet_clone/ui/widgets/loading_overlay.dart';
@@ -48,7 +47,7 @@ class _EditFlashCardPageState extends State<EditFlashCardSetPage> {
           message: AppTexts.editSuccess,
           status: SnackBarStatus.success,
         );
-        unawaited(Navigator.of(context).pushReplacementNamed(RouteNames.home));
+        Navigator.of(context).pop();
       case EditFlashCardErrorState errorState:
         showAppSnackBar(
           context,
diff --git a/lib/ui/pages/edit_flashcard_page.dart b/lib/ui/pages/edit_flashcard_page.dart
index 24bc812..419a208 100644
--- a/lib/ui/pages/edit_flashcard_page.dart
+++ b/lib/ui/pages/edit_flashcard_page.dart
@@ -2,8 +2,8 @@ import 'dart:async';
 
 import 'package:flutter/material.dart';
 import 'package:provider/provider.dart';
-import 'package:quizlet_clone/bloc/edit_bloc/edit_flashcard_form_bloc_state.dart';
 import 'package:quizlet_clone/bloc/edit_bloc/edit_flashcard_form_bloc.dart';
+import 'package:quizlet_clone/bloc/edit_bloc/edit_flashcard_form_bloc_state.dart';
 import 'package:quizlet_clone/ui/constants/app_texts.dart';
 import 'package:quizlet_clone/ui/pages/flashcardset_detail_page.dart';
 import 'package:quizlet_clone/ui/utils/show_app_snack_bar.dart';
diff --git a/lib/ui/pages/home_page.dart b/lib/ui/pages/home_page.dart
index 604ef7a..7cdb3a2 100644
--- a/lib/ui/pages/home_page.dart
+++ b/lib/ui/pages/home_page.dart
@@ -65,15 +65,19 @@ class _HomePageState extends State<HomePage> {
           floatingActionButton: FloatingActionButton(
             child: const Icon(AppIcons.add),
             onPressed: () {
-              unawaited(Navigator.of(context).push(
-                MaterialPageRoute(
-                  builder: (context) => ChangeNotifierProvider(
-                    create: (_) =>
-                        CreateFlashCardSetFormBloc(FlashCardSetService()),
-                    child: CreateFlashCardSetPage(),
-                  ),
-                ),
-              ));
+              unawaited(Navigator.of(context)
+                  .push(
+                    MaterialPageRoute(
+                      builder: (context) => ChangeNotifierProvider(
+                        create: (_) =>
+                            CreateFlashCardSetFormBloc(FlashCardSetService()),
+                        child: CreateFlashCardSetPage(),
+                      ),
+                    ),
+                  )
+                  .then((_) => setState(() {
+                        _flashCardListBloc.getFlashCardSets();
+                      })));
             },
           ),
         ),
diff --git a/lib/ui/widgets/flash_card_set_list.dart b/lib/ui/widgets/flash_card_set_list.dart
index bc2dcba..426b51a 100644
--- a/lib/ui/widgets/flash_card_set_list.dart
+++ b/lib/ui/widgets/flash_card_set_list.dart
@@ -2,11 +2,14 @@ import 'dart:async';
 
 import 'package:flutter/material.dart';
 import 'package:provider/provider.dart';
+import 'package:quizlet_clone/bloc/edit_bloc/edit_flash_card_bloc.dart';
 import 'package:quizlet_clone/bloc/flash_card_set_list_bloc.dart';
 import 'package:quizlet_clone/bloc/flash_card_set_list_bloc_state.dart';
 import 'package:quizlet_clone/bloc/flashcard_list_bloc/flashcard_list_bloc.dart';
+import 'package:quizlet_clone/data/flash_card_set_service.dart';
 import 'package:quizlet_clone/data/flashcard_service.dart';
 import 'package:quizlet_clone/ui/constants/app_texts.dart';
+import 'package:quizlet_clone/ui/pages/edit_flash_card_set_page.dart';
 import 'package:quizlet_clone/ui/pages/flashcardset_detail_page.dart';
 import 'package:quizlet_clone/ui/utils/show_app_snack_bar.dart';
 import 'package:quizlet_clone/ui/widgets/flash_card_set_list_tile.dart';
@@ -91,12 +94,15 @@ class _FlashCardSetListState extends State<FlashCardSetList> {
                       Navigator.of(context).push(
                         MaterialPageRoute(
                             builder: (context) => ChangeNotifierProvider(
-                              create: (_) => FlashCardListBloc(FlashCardService()),
-                              child: FlashCardSetDetailPage(
-                                    flashCardSetid: state.flashCardSets[index].id,
-                                    flashCardColorHex: state.flashCardSets[index].colorHex,
+                                  create: (_) =>
+                                      FlashCardListBloc(FlashCardService()),
+                                  child: FlashCardSetDetailPage(
+                                    flashCardSetid:
+                                        state.flashCardSets[index].id,
+                                    flashCardColorHex:
+                                        state.flashCardSets[index].colorHex,
                                   ),
-                            )),
+                                )),
                       ),
                     );
                   },
@@ -104,6 +110,21 @@ class _FlashCardSetListState extends State<FlashCardSetList> {
                     name: state.flashCardSets[index].name,
                     colorHex: state.flashCardSets[index].colorHex,
                     flashCardId: state.flashCardSets[index].id,
+                    onNavigateEditPressed: () => unawaited(
+                      Navigator.of(context).push(
+                        MaterialPageRoute(
+                          builder: (context) => ChangeNotifierProvider(
+                            create: (_) =>
+                                EditFlashCardBloc(FlashCardSetService()),
+                            child: EditFlashCardSetPage(
+                              flashCardSetId: state.flashCardSets[index].id,
+                            ),
+                          ),
+                        ),
+                      ).then((_){setState(() {
+                        _flashCardSetListBloc.getFlashCardSets();
+                      });}),
+                    ),
                   ),
                 ),
               ),
diff --git a/lib/ui/widgets/flash_card_set_list_tile.dart b/lib/ui/widgets/flash_card_set_list_tile.dart
index e4afbfb..802d723 100644
--- a/lib/ui/widgets/flash_card_set_list_tile.dart
+++ b/lib/ui/widgets/flash_card_set_list_tile.dart
@@ -1,12 +1,6 @@
-import 'dart:async';
-
 import 'package:color_hex/color_hex.dart';
 import 'package:flutter/material.dart';
-import 'package:provider/provider.dart';
-import 'package:quizlet_clone/bloc/edit_bloc/edit_flash_card_bloc.dart';
-import 'package:quizlet_clone/data/flash_card_set_service.dart';
 import 'package:quizlet_clone/ui/constants/app_icons.dart';
-import 'package:quizlet_clone/ui/pages/edit_flash_card_set_page.dart';
 
 //Presents a tile of Flashcard from the the Flashcard Set
 class FlashCardSetListTile extends StatelessWidget {
@@ -14,11 +8,13 @@ class FlashCardSetListTile extends StatelessWidget {
     required this.name,
     required this.colorHex,
     required this.flashCardId,
+    required this.onNavigateEditPressed,
     super.key,
   });
   final String name;
   final String colorHex;
   final String flashCardId;
+  final VoidCallback onNavigateEditPressed;
 
   //Converts hex code to RGB color for Flutter
   Color hexToColor(String hexCode) => Color(
@@ -34,20 +30,7 @@ class FlashCardSetListTile extends StatelessWidget {
           backgroundColor: colorHex.convertToColor,
         ),
         trailing: IconButton(
-          onPressed: () {
-            unawaited(
-              Navigator.of(context).push(
-                MaterialPageRoute(
-                  builder: (context) => ChangeNotifierProvider(
-                    create: (_) => EditFlashCardBloc(FlashCardSetService()),
-                    child: EditFlashCardSetPage(
-                      flashCardSetId: flashCardId,
-                    ),
-                  ),
-                ),
-              ),
-            );
-          },
+          onPressed: onNavigateEditPressed,
           icon: const Icon(AppIcons.edit),
         ),
       );
diff --git a/lib/ui/widgets/forms/flash_card_set_form.dart b/lib/ui/widgets/forms/flash_card_set_form.dart
index 64b5ca6..75b2293 100644
--- a/lib/ui/widgets/forms/flash_card_set_form.dart
+++ b/lib/ui/widgets/forms/flash_card_set_form.dart
@@ -7,8 +7,7 @@ class FlashCardSetForm extends StatelessWidget {
     required this.formKey,
     required this.colorHex,
     required this.nameController,
-    this.nameValidator,
-    required this.buttonLabel,
+    required this.buttonLabel, this.nameValidator,
     this.onPressed,
     this.isLoading = false,
     super.key,


Reviews:
user: login: PTLam-Thryve
state: CHANGES_REQUESTED
author_association: OWNER
submitted_at: 2025-04-08T14:51:47Z
user: login: Megadebt
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-09T08:29:44Z
user: login: Megadebt
state: COMMENTED
author_association: COLLABORATOR
submitted_at: 2025-04-09T08:30:18Z

Review comments:
diff_hunk: @@ -47,6 +47,7 @@ class _CreateFlashCardPageState extends State<CreateFlashCardSetPage> {
           message: AppTexts.createSuccess,
           status: SnackBarStatus.success,
         );
+        Navigator.of(context).pop();
         unawaited(Navigator.of(context).pushReplacementNamed(RouteNames.home));
path: lib/ui/pages/create_flash_card_set_page.dart
user: login: PTLam-Thryve
body: @Megadebt,

Great job! I missed this in the previous PR review.

Just a small note: please remove the `pushReplacementNamed` call to `HomePage`, since `HomePage` is already beneath the `CreateFlashCardPage` in the navigation stack. Now that you've added `Navigator.of(context).pop();`, the creation page will close and the home page will be shown again automatically.

```dart
unawaited(Navigator.of(context).pushReplacementNamed(RouteNames.home));
```

Thanks!
created_at: 2025-04-08T14:49:54Z
author_association: OWNER
diff_hunk: @@ -48,6 +48,7 @@ class _EditFlashCardPageState extends State<EditFlashCardSetPage> {
           message: AppTexts.editSuccess,
           status: SnackBarStatus.success,
         );
+        Navigator.of(context).pop();
         unawaited(Navigator.of(context).pushReplacementNamed(RouteNames.home));
path: lib/ui/pages/edit_flash_card_set_page.dart
user: login: PTLam-Thryve
body: @Megadebt,

please do the same here as above
created_at: 2025-04-08T14:50:11Z
author_association: OWNER
diff_hunk: @@ -47,6 +47,7 @@ class _CreateFlashCardPageState extends State<CreateFlashCardSetPage> {
           message: AppTexts.createSuccess,
           status: SnackBarStatus.success,
         );
+        Navigator.of(context).pop();
         unawaited(Navigator.of(context).pushReplacementNamed(RouteNames.home));
path: lib/ui/pages/create_flash_card_set_page.dart
user: login: Megadebt
body: Hello @PTLam-Thryve , I've updated the code! The Homepage does not automatically reload once Create/Edit page is popped so I had to add a setState to make sure Homepage is updated!
created_at: 2025-04-09T08:29:44Z
author_association: COLLABORATOR
diff_hunk: @@ -48,6 +48,7 @@ class _EditFlashCardPageState extends State<EditFlashCardSetPage> {
           message: AppTexts.editSuccess,
           status: SnackBarStatus.success,
         );
+        Navigator.of(context).pop();
         unawaited(Navigator.of(context).pushReplacementNamed(RouteNames.home));
path: lib/ui/pages/edit_flash_card_set_page.dart
user: login: Megadebt
body: @PTLam-Thryve this pushReplacement here is also gone!
created_at: 2025-04-09T08:30:17Z
author_association: COLLABORATOR

PR comments:
user: login: Megadebt
created_at: 2025-04-02T17:09:32Z
body: @CodiumAI-Agent /review

author_association: COLLABORATOR
user: login: QodoAI-Agent
created_at: 2025-04-02T17:10:21Z
body: ## PR Reviewer Guide 🔍

#### (Review updated until commit https://github.com/PTLam-Thryve/quizlet_clone/commit/edc3fd0a59a0aaab267a50872f5839a2b0a557af)


Here are some key observations to aid the review process:

<table>
<tr><td>⏱️&nbsp;<strong>Estimated effort to review</strong>: 2 🔵🔵⚪⚪⚪</td></tr>
<tr><td>🧪&nbsp;<strong>No relevant tests</strong></td></tr>
<tr><td>🔒&nbsp;<strong>No security concerns identified</strong></td></tr>
<tr><td>⚡&nbsp;<strong>Recommended focus areas for review</strong><br><br>

<details><summary><a href='https://github.com/PTLam-Thryve/quizlet_clone/pull/33/files#diff-24350442dd1d093581953f485fd4c1c4014856d3bacd15f8a41aca9ed923373dR94-R106'><strong>Indentation Issue</strong></a>

The indentation in the deleteFlashcardById method was fixed, but there's inconsistency in the try-catch block structure compared to other methods in the service.
</summary>

```dart
try {
  var flashcardCollection = _fireStore
      .collection('flashcard-sets')
      .doc(flashcardSetId)
      .collection('flashcards');
  await flashcardCollection.doc(flashcardId).delete();
  return Flashcard(
    id: flashcardId,
    setId: flashcardSetId,
    question: question,
    answer: answer,
  );
} on FirebaseException catch (error) {
```

</details>

<details><summary><a href='https://github.com/PTLam-Thryve/quizlet_clone/pull/33/files#diff-24350442dd1d093581953f485fd4c1c4014856d3bacd15f8a41aca9ed923373dR75-R80'><strong>Return Value Bug</strong></a>

In the updateFlashcard method, the function now returns a Flashcard with the correct ID, but it should verify if the update operation was successful before returning.
</summary>

```dart
return Flashcard(
  id: flashCardId,
  setId: flashCardSetId,
  question: newQuestion,
  answer: newAnswer,
);
```

</details>

</td></tr>
</table>

author_association: NONE
user: login: Megadebt
created_at: 2025-04-02T17:24:18Z
body: @CodiumAI-Agent /review

author_association: COLLABORATOR
user: login: QodoAI-Agent
created_at: 2025-04-02T17:25:07Z
body: **[Persistent review](https://github.com/PTLam-Thryve/quizlet_clone/pull/33#issuecomment-2773215490)** updated to latest commit https://github.com/PTLam-Thryve/quizlet_clone/commit/79d6ac5d9664a65c99607e13157d7cfaa9e544aa
author_association: NONE
user: login: Megadebt
created_at: 2025-04-02T17:28:12Z
body: @CodiumAI-Agent /review

author_association: COLLABORATOR
user: login: Megadebt
created_at: 2025-04-02T17:42:25Z
body: @CodiumAI-Agent /review

author_association: COLLABORATOR
user: login: QodoAI-Agent
created_at: 2025-04-02T17:43:10Z
body: **[Persistent review](https://github.com/PTLam-Thryve/quizlet_clone/pull/33#issuecomment-2773215490)** updated to latest commit https://github.com/PTLam-Thryve/quizlet_clone/commit/edc3fd0a59a0aaab267a50872f5839a2b0a557af
author_association: NONE
user: login: Megadebt
created_at: 2025-04-02T17:44:07Z
body: @CodiumAI-Agent /improve
author_association: COLLABORATOR
user: login: QodoAI-Agent
created_at: 2025-04-02T17:45:32Z
body: ## PR Code Suggestions ✨

Explore these optional code suggestions:

<table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>General</td>
<td>



<details><summary>Improve return value semantics</summary>

___


**The <code>deleteFlashcardById</code> method returns a <code>Flashcard</code> object representing the <br>deleted flashcard, but this can be misleading since the flashcard no longer <br>exists in the database. Consider returning a boolean success value or void <br>instead.**

[lib/data/flashcard_service.dart [88-105]](https://github.com/PTLam-Thryve/quizlet_clone/pull/33/files#diff-24350442dd1d093581953f485fd4c1c4014856d3bacd15f8a41aca9ed923373dR88-R105)

```diff
-Future<Flashcard> deleteFlashcardById({
+Future<bool> deleteFlashcardById({
   required String question,
   required String answer,
   required String flashcardSetId,
   required String flashcardId,
 }) async {
   try {
     var flashcardCollection = _fireStore
         .collection('flashcard-sets')
         .doc(flashcardSetId)
         .collection('flashcards');
     await flashcardCollection.doc(flashcardId).delete();
-    return Flashcard(
-      id: flashcardId,
-      setId: flashcardSetId,
-      question: question,
-      answer: answer,
-    );
+    return true;
```

- [ ] **Apply this suggestion** <!-- /improve --apply_suggestion=0 -->

<details><summary>Suggestion importance[1-10]: 7</summary>

__

Why: The suggestion correctly identifies a semantic issue where the method returns a recreated Flashcard object after deletion, which is misleading. Returning a boolean success value is more appropriate for a delete operation and better represents the actual result.


</details></details></td><td align=center>Medium

</td></tr>
<tr><td align="center" colspan="2">

- [ ] Update <!-- /improve --more_suggestions=true -->

</td><td></td></tr></tbody></table>
author_association: NONE
user: login: qodo-code-review[bot]
created_at: 2025-04-02T17:46:49Z
body: _Qodo Merge was enabled for this repository. To continue using it, please link your Git account with your Qodo account [here](https://app.qodo.ai/qodo-merge)._

## PR Code Suggestions ✨

<!-- edc3fd0 -->

Explore these optional code suggestions:

<table><thead><tr><td><strong>Category</strong></td><td align=left><strong>Suggestion&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; </strong></td><td align=center><strong>Impact</strong></td></tr><tbody><tr><td rowspan=1>General</td>
<td>



<details><summary>Improve return value semantics</summary>

___


**The <code>deleteFlashcardById</code> method returns a <code>Flashcard</code> object representing the <br>deleted flashcard, but this can be misleading since the flashcard no longer <br>exists in the database. Consider returning a boolean success value or void <br>instead.**

[lib/data/flashcard_service.dart [88-105]](https://github.com/PTLam-Thryve/quizlet_clone/pull/33/files#diff-24350442dd1d093581953f485fd4c1c4014856d3bacd15f8a41aca9ed923373dR88-R105)

```diff
-Future<Flashcard> deleteFlashcardById({
+Future<bool> deleteFlashcardById({
   required String question,
   required String answer,
   required String flashcardSetId,
   required String flashcardId,
 }) async {
   try {
     var flashcardCollection = _fireStore
         .collection('flashcard-sets')
         .doc(flashcardSetId)
         .collection('flashcards');
     await flashcardCollection.doc(flashcardId).delete();
-    return Flashcard(
-      id: flashcardId,
-      setId: flashcardSetId,
-      question: question,
-      answer: answer,
-    );
+    return true;
```

- [ ] **Apply this suggestion** <!-- /improve --apply_suggestion=0 -->

<details><summary>Suggestion importance[1-10]: 7</summary>

__

Why: The suggestion correctly identifies a semantic issue where the method returns a recreated Flashcard object after deletion, which is misleading. Returning a boolean success value is more appropriate for a delete operation and better represents the actual result.


</details></details></td><td align=center>Medium

</td></tr>
<tr><td align="center" colspan="2">

- [ ] More <!-- /improve --more_suggestions=true -->

</td><td></td></tr></tbody></table>


author_association: NONE
user: login: Megadebt
created_at: 2025-04-02T17:47:06Z
body: Hello @PTLam-Thryve, I believe I've completed my work on this branch. Please check my code when you have the time!
author_association: COLLABORATOR
user: login: QodoAI-Agent
created_at: 2025-04-02T17:47:52Z
body: ## PR Code Suggestions ✨

No code suggestions found for the PR.
author_association: NONE