I'm starting to work with Appwrite and would like to better understand the execution context of Functions;
Could I make a shared folder between functions and place them in a single repository?
For example, in the following structure:
└── functions ├── make_dove_appear │ └── main.dart ├── make_rabbit_appear │ └── main.dart └── shared └── my_magic_hat.dart
The main.dart file from my make_rabbit_appear folder/function, could you import my_magic_hat.dart from a subfolder of the directory?
import '../shared/my_magic_hat.dart';
void main() {
// Loaded from the shared sub-folder?
final magicHat = MyMagicHat();
magicHat.makeAnimalAppear(
AnimalAvailable.rabbit,
);
}
See that I will register two different functions. They will be called from different places and will have different functions.
But they used some common resource.
If you deploy function and specify make_dove_appear as the folder, only that folder is added into the container for building
That said, you can share code by using symlinks to make it as if the common folder was in the folder being deployed
And then put an entry in your pub spec that points to that path
So something like:
- functions
- dependencies
- common <--- symlink
- lib
- main.dart
- pubspec.yaml
- dependencies
And pubspec has
dependencies:
common:
path: dependencies/common
It's pretty clear now! Thank you for your time and tip!
Recommended threads
- Excessive usage of cloud functions is sl...
I have made almost all my requests through cloud functions and jwt , due to security fears of a user editing a field he is not supposed to . This unfortunately...
- Dart Runtime as Function is missing
Hey guys, I set the _APP_FUNCTIONS_RUNTIMES to dart-3.10 and redeployed the appwrite stack but unfortunately the dart runtime doesnt show up. I copied the val...
- Go 1.25 runtime
So I'm trying to use go 1.25 for my functions and I can only find go-1.23 as a function runtime. So I did some searching and found https://github.com/appwrite/a...