Flutter -- Monorepo Repository

Hello,

I have imported my project via Github and it has a monorepo structure. Can’t seem to find a way to run web or android previews for any projects due to idx config file not being located in the root folder. I have tried to create a workspace for each individual application in the monorepo but that does not seem to work. Does anyone have advice?

In the idx/dev.nix file you can mention the current working director as part of the preview and that will display the preview once the env rebuilds

1 Like

Hey,

Thank you for your reply.
Sorry for being a bit daft but could you please point out where exactly i can set the cwd in that config file?

Hey, as other have mentioned, cwd can be set in dev.nix. It is in the same block as “command” and “manager” block.

previews = {
  web = {
    command = ["flutter" "run" "--machine" "-d" "web-server" "--web-hostname" "0.0.0.0" "--web-port" "$PORT"];
    manager = "flutter";
    cwd = "<path to your flutter project root>";
  };
}

You would do something like this:
{pkgs, …}: {
idx.previews = {
enable = true;
previews = {
web = {
command = [“yes”];
cwd = “subfolder”;
manager = “web”;
env = {
HELLO = “world”;
};
};
};
};
}

https://developers.google.com/idx/guides/devnix-reference

Awesome!

Thank you very much for your support guys.

@Adrian_Grigorescu i can help you in this matter

@manishmg3994 Thank you but I have it figured it out for now