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
- Attributes Confusion
```import 'package:appwrite/models.dart'; class OrdersModel { String id, email, name, phone, status, user_id, address; int discount, total, created_at; L...
- How to Avoid Double Requests in function...
I'm currently using Appwrite's `functions.createExecution` in my project. I want to avoid double requests when multiple actions (like searching or pagination) a...
- Project in AppWrite Cloud doesn't allow ...
I have a collection where the data can't be opened. When I check the functions, there are three instances of a function still running that can't be deleted. The...