
visited doc but not get any idea,

Basically you create one to make a specific thing with your data or backend and then you trigger it to be executed from an app, an event (database, Auth), manually or scheduled

any basic idea if you can provide like what is happening in this function or what is use for res and req and how to trigger on event or create document from function ```Future<void> start(final req, final res) async { final client = Client();
//Uncomment the services you need, delete the ones you don't final account = Account(client); final avatars = Avatars(client); final database = Databases(client); final functions = Functions(client); final health = Health(client); final locale = Locale(client); final storage = Storage(client); final teams = Teams(client); final users = Users(client);
if (req.variables['APPWRITE_FUNCTION_ENDPOINT'] == null || req.variables['APPWRITE_FUNCTION_API_KEY'] == null) { print( "Environment variables are not set. Function cannot use Appwrite SDK."); } else { client .setEndpoint(req.variables['APPWRITE_FUNCTION_ENDPOINT']) .setProject(req.variables['APPWRITE_FUNCTION_PROJECT_ID']) .setKey(req.variables['APPWRITE_FUNCTION_API_KEY']) .setSelfSigned(status: true); }
res.json({ 'areDevelopersAwesome': true, }); }```

What it makes is showing a response who is 'areDevelopersAwesome': true

What's inside the Future<void> function is what's executed

Other things are requests made to start appwrite services. You can delete what you will not use

do you have any idea for creating document from function so that i can create 10 document in just single click ?

Same as you would have done with flutter: run this 10 times for each document you need to create:
import 'package:appwrite/appwrite.dart';
void main() { // Init SDK
Client client = Client();
Databases databases = Databases(client);
client
.setEndpoint('https://cloud.appwrite.io/v1') // Your API Endpoint
.setProject('5df5acd0d48c2') // Your project ID
;
Future result = databases.createDocument(
databaseId: '[DATABASE_ID]',
collectionId: '[COLLECTION_ID]',
documentId: '[DOCUMENT_ID]',
data: {},
);
result
.then((response) {
print(response);
}).catchError((error) {
print(error.response);
});
}

If I'm not wrong, currently it's not possible to bulk-create documents, so you will need to trigger the above code the same amount of times as documents you will need. However such feature has been suggested: https://github.com/appwrite/appwrite/issues/3051
You can give it a 👍
Recommended threads
- Origin error after changing default port...
Hi! I need some help regarding an issue I’m facing with Appwrite after changing the default ports. I have a self-hosted Appwrite instance running on my VPS. I ...
- Opened my website after long time and Ba...
I built a website around a year back and and used appwrite for making the backend. At that time the website was working fine but now when i open it the images a...
- custom requirements.txt file
How do I specify a custom requirements.txt file when creating a serverless function through the Appwrite console?
