website/docs/guides/miscellaneous/directory.md
:::info
This page is about the directory generated by flutter_rust_bridge_codegen create/integrate.
You are free to use whatever other methods to integrate Rust with Dart.
:::
import DirectoryStructureBriefExplain from '../../snippets/_directory-structure-brief-explain.mdx'; import DirectoryStructureBriefList from '../../snippets/_directory-structure-brief-list.mdx';
<DirectoryStructureBriefExplain/>Briefly speaking, the folders are:
<DirectoryStructureBriefList/>Firstly, everything in this section only applies to the default template as a starter kit. You are surely free to customize everything, use your own template, etc, and flutter_rust_bridge continues to work well.
As mentioned above, a good starting point to write code is lib/main.dart and rust/src/api/simple.rs.
Suppose we want to add more files:
lib (the recommended place is inside lib/src).rust/src/api.Remark: When adding a Rust file, remember to add it as a module in mod.rs.
Otherwise, Rust (and flutter_rust_bridge) will act as if your file does not exist at all.
For example, after creating rust/src/api/another.rs,
we need to add a line pub mod another; inside rust/src/api/mod.rs.
If you are interested:
The rust_builder dummy package is likely to be able to be removed
after the Dart "native assets" language feature is stabilized,
which acts as a build hook similar to build.dart in the "native assets" feature.