Flutter and IDX

If you have any issues with Flutter and IDX please tag me and/or idx

https://idx.google.com/new/flutter

15 Likes

First time I heard about it. Have to try first thing tomorrow

1 Like

Best tool for workshop

4 Likes

Yes indeed. I did a recent workshop, and instead of walking through the flutter install for the first hour of three, I was “go to this URL, login with a gmail addr”, and they were ready to follow along with my guidance.

5 Likes

Workshops and hackathons are uses for IDX I’m pretty excited about. Should be able to skip the two hour “let’s get everyone’s machine setup” phase of helping a roomful of devs to try Flutter.

Also, you can now edit the Dart website in IDX, and Rody’s landing an update to do the same for docs.flutter.dev!

7 Likes

Are there any plans to add support for Jaspr?

There are 2 paths:

  1. Create the nix template files inside the jaspr repo and add “Open in IDX” button to readme
  2. Create a folder on the community-templates repo: GitHub - project-idx/community-templates: A library of templates to get you started faster and explore tools, frameworks, and runtimes.

If you want to see an example of number 1, check out my signals repo!

1 Like

I did actually have a question regarding the Gemini integration. In an ideal world it would be able to consult the Flutter and Dart documentation as a real source of authority but I was unclear about how that works in practice or not. I was just wondering if you could provide and insight as to what relationship if any there was there both with the documentation but also other data sources?

1 Like

We just introduced a new preview feature called “Interactive Chat” where Gemini can read and write files and run terminal commands. I already use this to read various readmes in the project and follow instructions based on the contents.

We are also working with the Flutter and Dart teams to make sure that the results for Gemini generation are up to date and correct. Not an solved problem but there is work going on.

4 Likes

I had some issues when importing an existing flutter app to the idx. I needed to make .idx folder and the configuration file manually. I don’t know if there is an easier way for doing that.

For an existing flutter project you can create the following file .idx/dev.nix:

# To learn more about how to use Nix to configure your environment
# see: https://developers.google.com/idx/guides/customize-idx-env
{ pkgs, ... }: {
  # Which nixpkgs channel to use.
  channel = "stable-23.11"; # or "unstable"
  # Use https://search.nixos.org/packages to find packages
  packages = [
    pkgs.jdk17
    pkgs.unzip
  ];
  # Sets environment variables in the workspace
  env = {};
  idx = {
    # Search for the extensions you want on https://open-vsx.org/ and use "publisher.id"
    extensions = [
      "Dart-Code.flutter"
      "Dart-Code.dart-code"
    ];
    workspace = {
      # Runs when a workspace is first created with this `dev.nix` file
      onCreate = {
        build-flutter = ''
          cd /home/user/myapp/android

          ./gradlew \
            --parallel \
            -Pverbose=true \
            -Ptarget-platform=android-x86 \
            -Ptarget=/home/user/myapp/lib/main.dart \
            -Pbase-application-name=android.app.Application \
            -Pdart-defines=RkxVVFRFUl9XRUJfQ0FOVkFTS0lUX1VSTD1odHRwczovL3d3dy5nc3RhdGljLmNvbS9mbHV0dGVyLWNhbnZhc2tpdC85NzU1MDkwN2I3MGY0ZjNiMzI4YjZjMTYwMGRmMjFmYWMxYTE4ODlhLw== \
            -Pdart-obfuscation=false \
            -Ptrack-widget-creation=true \
            -Ptree-shake-icons=false \
            -Pfilesystem-scheme=org-dartlang-root \
            assembleDebug

          # TODO: Execute web build in debug mode.
          # flutter run does this transparently either way
          # https://github.com/flutter/flutter/issues/96283#issuecomment-1144750411
          # flutter build web --profile --dart-define=Dart2jsOptimization=O0 

          adb -s localhost:5555 wait-for-device
        '';
      };
      
      # To run something each time the workspace is (re)started, use the `onStart` hook
    };
    # Enable previews and customize configuration
    previews = {
      enable = true;
      previews = {
        web = {
          command = ["flutter" "run" "--machine" "-d" "web-server" "--web-hostname" "0.0.0.0" "--web-port" "$PORT"];
          manager = "flutter";
        };
        android = {
          command = ["flutter" "run" "--machine" "-d" "android" "-d" "localhost:5555"];
          manager = "flutter";
        };
      };
    };
  };
}

Does “not an unsolved problem” mean it’s already solved? :slight_smile:

Good point, I edited. Just meaning it is being improved and looked at, but will probably never be “done”.

From the idx dashboard, when I click the Android Studio Experimental - Try building native Android apps entirely in the browser, when I start filling out the form it gives the error:

‘Unable to save your draft’

Any thoughts?

That is definitely not intended! Can you file an issue and I’ll share it with the team?

Yes, I will post there.

Duuude, I love IDX, using for learning purposes, proof of concepts, teaching and so on…

1 Like

That’s amazing!!

True … but still a little cumbersome for coding

What issues are you having?

IDX is not about replacing local development but about making it possible to not have compromises when building remotely with access to a suite of AI tools, full VM and rich package ecosystem.