5 highly productive ways to use Inline Code Attachments
Attach all the code snippets you need in your inline query and perform any tasks.
CommandDash can execute any Flutter development tasks for you given that it has the right contextual code. For example, to write an integration test, it needs to have information about all widgets involved in the particular test flow.
This can be simply achieved with inline code attachments - a seamless way to attach any code snippet from within your project as you interact with Dash AI.
Three Step Framework
Through all the examples in this blog, we will follow a three step framework using inline code attachments that will get CommandDash to perform any task for you. It involves the parts:
- Command: Your instructions explaining the task.
- Key Objects: The primary code objects involved in the task.
- References [Optional]: Any previously existing references.
Let's begin with exloring all usecases.
1. Refactoring / Migrating Code Base
We often refactor or migrate our codebase from one architecture to another. Say, currently you are using GetX, and want to move to Bloc. This is a pretty commmon scenario.
You can simply attach your code along with supporting contextual code in the Dash field using Attach Snippet to Dash
or CMD+R
.
We have the refactored Bloc code in our CommandDash panel! No more stress about upgrading your codebases.
2. Adding new files
From the previous example, we have the Controller, API Client and the Data Models ready, and say we need to add the LoginScreen.
This is how we could instantly do it :)
public/images/docs/activated-gemini.png
3. Making multi-file updates
Once a feature is published, follow on updates usually require changing code across files. For example, in the last example, we added the ability to login using email and password.
Suppose, we also want to support Facebook login, that will require changes from repository to the widget. But that's not difficult with Dash AI in your IDE.
4. Code Review / Optimizations
Now that the feature is done, it would be nice to get a review on our code. We can simply attach the entire file group of the feature and get feedback from Dash AI.
Look like Dash AI wants us to write some tests! Let's add an integration test.
5. Writing Integration tests
Writing integration tests in Flutter can be extremely rewarding and time saving in the course of building your apps. However, integration tests take time to write and require context of code across multiple files.
Dash AI can do the heavy lifting for you, writing the integration test for your use case. However, do note that integration tests written looking at widgets code alone will not be perfect, and may require further debugging to get them working.
Here is how you can get started with them: