DEV Community

Cover image for Flutter πŸ’™ Cursor: setting up Background Agent
Anton Malofeev
Anton Malofeev

Posted on

Flutter πŸ’™ Cursor: setting up Background Agent

If you prefer to use Jules (Google AI Agent ), check out this article.

Short story β€” Cursor introduced AI Agents which allows you to run any tasks in background the same way as in IDE with the same setup.
To give proper setup for AI Agent, we need to setup container the same way you would do for your own computer.

Let’s get started:

  1. Open Cursor Settings (the panel may be placed in different place, since it depends on how you customized your interface, so you could use Command+Shift+P to open command panel and type β€œcursor settings”).
  2. Open Background Agents panel

  1. Give Cursor GitHub Access for your sepcific repository. Click Go To GitHub to allow access to.

  1. Select your repository, to allow access to. Notice: for public repositories owned by organizations, you will have to fork the repository to your personal repositories.

  1. After allowing access, make sure you click refresh and you should see Access Granted.

  1. Click Base Environment and then Setup machine interactively.

  1. Wait until you see the chat interface

  1. Write to agent the command to install required dependencies. Use agent mode, so agent could verify setup and update other dependencies if needed.

I used the following script:

Hi. Please install Flutter & Dart.

Use the command below:

# Install Dart SDK (using apt, official Google repo)
sudo apt-get update
sudo apt-get install -y apt-transport-https wget
wget -qO- https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo gpg --dearmor -o /etc/apt/keyrings/dart.gpg
echo "deb [signed-by=/etc/apt/keyrings/dart.gpg] https://storage.googleapis.com/download.dartlang.org/linux/debian stable main" | sudo tee /etc/apt/sources.list.d/dart_stable.list
sudo apt-get update
sudo apt-get install -y dart
# Add Dart to PATH
export PATH="$PATH:/usr/lib/dart/bin"
# Clone Flutter
cd /opt && sudo git clone https://github.com/flutter/flutter.git -b stable
sudo chown -R $USER:$USER /opt/flutter
export PATH="$PATH:/opt/flutter/bin" && cd /workspace
flutter pub get
Enter fullscreen mode Exit fullscreen mode

  1. After Agent finished the job, click Take Snapshot

  1. Add command flutter pub get or any script you usually use to get all dependencies in your project

  1. After that, verify that everything works

  1. That’s it! Now you can use background agent from any accessible ui point (from settings, from tab, pwa app or cursor website).

I hope this concept proves useful :-)

Please share your thoughts in the comments :-) This will help make this article visible to others and will be great support and motivation :-)

Thank you for your time and have a good day!

Anton

Top comments (0)