🧪 Flutter Test Generator
The Model Test Generator feature of this extension helps you quickly scaffold unit tests for your Dart model classes in Flutter projects — saving time and improving consistency. 🚀 Features✅ Adds a right-click menu option: ✅ Automatically generates model test templates based on this structure: ✅ Outputs test files like this: ✅ Works on single files and entire folders 📂 How It Works✅ Right Click on a Dart File
✅ Right Click on a Folder
🧱 Generated Test StructureEach generated test file includes:
📝 Comment Tags//IMPORTS//: Used for auto-managing necessary imports during test generation or modification. //-START// and //-END//: Marks the beginning and end of each model's test block. ⚠️ Do not remove or edit these manually unless you want to completely regenerate that test. //LAST-LINE//: Acts as an anchor to append new model tests in the future if additional classes are found in the same file. ⚠️ RequirementsTo enable model test generation: The filename and class name must include the word "MODEL" Example: ✅ user_model.dart with class UserModel ✅ productMODEL.dart with class ProductMODEL ❌ user.dart with class User 💡 Why Use This?. Saves time writing repetitive test templates . Enforces a consistent structure for unit tests . Scalable — works with multiple files and folders . Easy to modify and extend tests in future using the comment anchors 📌 TipIf you want to regenerate a specific model test, delete the block between:
Then re-run the extension on that file or folder. 🙌 Contribution & FeedbackFound a bug or have a suggestion? Feel free to open an issue or pull request on GitHub. |