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
- Which flutter SDK version for Self Hoste...
Hi all, Is there a good way to figure out which version of flutter SDK and Dart SDK is current for latest available self-hosted 1.8.0 ? I know new features are...
- The file size is either not valid or exc...
Hello, I am receiving the following error when I am trying to deploy a function from my local. ``` > appwrite push functions --function-id xxxxxxxxx ℹ Info: Va...
- redirect_uri errors on flutter client
Hi all, I'm using the flutter client for my app to do appwrite auth and use the JWTs to send to my backend. When I try to sign in with SSO, I get this: https:/...