thlorenz / rid

Rust integrated Dart framework providing an easy way to build Flutter apps with Rust.
63 stars 4 forks source link

The Flutter SDK is not available #19

Closed cipherchabon closed 2 years ago

cipherchabon commented 3 years ago

When trying to run the flutter examples, it throws the following error:

2021-08-25 10:03:08,360 DEBUG [rid_build::ffigen::run_ffigen] Running '"dart" "run" "ffigen" "--config" "/tmp/.tmpoThyRa/ffigen_config.yaml"' from: '"/home/marcos/Proyectos/ffi_demos/rid-examples/flutter/todo"'
thread 'main' panicked at 'Build failed: 'dart run ffigen' failed to run successfully
stderr: The Flutter SDK is not available. 
stdout: ', rid_build.rs:30:26

In my case the problem turned out to be that I use a version manager (FVM). Then I was able to solve it by simply modifying the FFIGEN_RUNNER value from dart to fvm dart in the file: id-build/src/ffigen/run_ffigen.rs

const FFIGEN_RUNNER: &str = "fvm dart";

I wonder if there is a way to include this case to avoid having to modify the code by hand.

thlorenz commented 3 years ago

The only option I see here is to allow devs to override the FFIGEN_RUNNER via a config. Let's keep this open, but I don't think it makes much sense to invest much work for now since you found a workaround. When creating the rid cli tool I'll make sure to make this configurable.

MGlolenstine commented 3 years ago

If you're running it on Linux and you don't mind making some aliases, you can add alias dart=fvm dart, which IMHO fvm should've done. Scripts should work without a hitch after.

thlorenz commented 2 years ago

Closing since this is an edge case and a workaround exists. Will be addressed for the CLI tool via a config option.