Hi -thank you for sharing
Let me take a look
import 'package:flutter/material.dart';
import 'homepage.dart';
void main() {
runApp(const MyApp());
}
class MyApp extends StatelessWidget {
const MyApp({super.key});
// This widget is the root of your application.
@override
Widget build(BuildContext context) {
return MaterialApp(
title: 'Todo App',
theme: ThemeData(
// This is the theme of your application.
//
// Try running your application with "flutter run". You'll see the
// application has a blue toolbar. Then, without quitting the app, try
// changing the primarySwatch below to Colors.green and then invoke
// "hot reload" (press "r" in the console where you ran "flutter run",
// or simply save your changes to "hot reload" in a Flutter IDE).
// Notice that the counter didn't reset back to zero; the application
// is not restarted.
primarySwatch: Colors.blue,
),
home: const Homepage(),
);
}
}
Main.dart
auth.dart
import 'package:appwrite/appwrite.dart';
Client client = Client()
.setEndpoint('http://localhost/v1')
.setProject('64392f2ec924b428ae8c')
.setSelfSigned(
status: true); // For self signed certificates, only use for development
//create an user account
Account account = Account(client);
Future createUser() async {
final user = await account.create(
userId: ID.unique(),
email: 'me@appwrite.io',
password: 'password',
name: 'My Name');
print("New User created");
}
homepage.dart
import 'package:flutter/material.dart';
import 'package:flutter/src/widgets/framework.dart';
import 'package:flutter/src/widgets/placeholder.dart';
import 'package:todo_app/auth.dart';
class Homepage extends StatelessWidget {
const Homepage({super.key});
@override
Widget build(BuildContext context) {
return Scaffold(
body: Center(
child: TextButton(
child: const Text("Create User"),
onPressed: () {
createUser();
},
),
));
}
}
@Steven please help
your problem is that localhost refers to the current device so your android emulator will try to connect to itself rather than your host machine where Appwrite is running. On an android emulator, instead of localhost, you can use 10.0.2.2, a special IP that refers to the host machine.
localhost wouldn't work as it would try to connect to itself rather than your computer host
you need to use this
http://{YOUR_COMUPTER_IPV4_ADDRESS}:{PORT}}/v1
Ok thanks 🙏
Let me check
Can we close this issue if its resolved @Jebin shaju https://github.com/appwrite/sdk-for-flutter/issues/142
no, now no errror occur but the appwrite dashboard doesnot show user being added
There's gotta be an error...maybe you're not catching it in your code
yes i think so
but i have 28 request to the app write
maybe from the console or something
http://10.0.2.2/v1 isnt this the ip i should be using
when using an emulator
sure...or maybe https://10.0.2.2/v1
both are not working
any ways thanks for your support, really like your support team
what's the error?
are you sure you're looking in the right project?
Recommended threads
- Apple OAuth Scopes
Hi Hi, I've configured sign in with apple and this is the response i'm getting from apple once i've signed in. I cant find anywhere I set scopes. I remember se...
- Sign In With Apple OAuth Help
Hi All! I've got a flutter & appwrite app which Im trying to use sign in with apple for. I already have sign in with google working and the function is the sam...
- Custom Domains
Hi All, Should be a quick config issue. I'm setting up custom domains on the hosted version. I have verified the domain with the CNAME but appwrite isn't gene...