Authentication is complete. If this does not happen automatically, please close the window. ``` Redirection URL passed to the authentication service must be the same as the URL on which the application is running (schema, host, port if necessary) and the path must point to created HTML file, /auth.html in this case. The callbackUrlScheme parameter of the authenticate() method does not take into account, so it is possible to use a schema for native platforms in the code. #### Flutter Web Cross-Domain Communication & Cookies While running Flutter Web, make sure your Appwrite server and your Flutter client are using the same top-level domain and the same protocol (HTTP or HTTPS) to communicate. When trying to communicate between different domains or protocols, you may receive HTTP status error 401 because some modern browsers block cross-site or insecure cookies for enhanced privacy. In production, Appwrite allows you set multiple [custom-domains](https://appwrite.io/docs/custom-domains) for each project. ### Windows For **Windows** add your app name and package name, Your package name is generally the **name** in your pubspec.yaml file. If you cannot find the correct package name, run the application in windows, and make any request with proper exception handling, you should get the application id needed to add in the received error message. ### Init your SDK
Initialize your SDK with your Appwrite server API endpoint and project ID, which can be found in your project settings page. ```dart import 'package:appwrite/appwrite.dart'; void main() { Client client = Client(); client .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint .setProject('5e8cf4f46b5e8') // Your project ID .setSelfSigned() // Use only on dev mode with a self-signed SSL cert ; } ``` Before starting to send any API calls to your new Appwrite instance, make sure your Android or iOS emulators has network access to the Appwrite server hostname or IP address. When trying to connect to Appwrite from an emulator or a mobile device, localhost is the hostname for the device or emulator and not your local Appwrite instance. You should replace localhost with your private IP as the Appwrite endpoint's hostname. You can also use a service like [ngrok](https://ngrok.com/) to proxy the Appwrite API. ### Make Your First Request
Once your SDK object is set, access any of the Appwrite services and choose any request to send. Full documentation for any service method you would like to use can be found in your SDK documentation or in the [API References](https://appwrite.io/docs) section. ```dart // Register User Account account = Account(client); Response user = await account .create( userId: '[USER_ID]', email: 'me@appwrite.io', password: 'password', name: 'My Name' ); ``` ### Full Example ```dart import 'package:appwrite/appwrite.dart'; void main() { Client client = Client(); client .setEndpoint('https://localhost/v1') // Your Appwrite Endpoint .setProject('5e8cf4f46b5e8') // Your project ID .setSelfSigned() // Use only on dev mode with a self-signed SSL cert ; // Register User Account account = Account(client); Response user = await account .create( userId: '[USER_ID]', email: 'me@appwrite.io', password: 'password', name: 'My Name' ); } ``` ### Error Handling The Appwrite Flutter SDK raises `AppwriteException` object with `message`, `code` and `response` properties. You can handle any errors by catching `AppwriteException` and present the `message` to the user or handle it yourself based on the provided error information. Below is an example. ```dart Users users = Users(client); try { final response = await users.create(userId: '[USER_ID]', email: ‘email@example.com’,password: ‘password’, name: ‘name’); print(response.data); } on AppwriteException catch(e) { //show message to user or do other operation based on error as required print(e.message); } ``` ### Learn more You can use the following resources to learn more and get help - 🚀 [Getting Started Tutorial](https://appwrite.io/docs/getting-started-for-flutter) - 📜 [Appwrite Docs](https://appwrite.io/docs) - 💬 [Discord Community](https://appwrite.io/discord) - 🚂 [Appwrite Flutter Playground](https://github.com/appwrite/playground-for-flutter)