I'm trying to create a user name and password in my Social Network app, and this keeps popping up.
class AppwriteConstants { static const String databaseID = '64df6c6d91........'; static const String projectID = '64df63.........'; static const String endPoint = 'http://My_Ip_Address/v1'; //static const String endPoint = 'http://localhost:80/v1'; }
I've tried both endPoint versions and i keep getting the same issue. Hope someone can help me!
can you show how do you intialise the client?
using port 80 or anything else?
import 'package:appwrite/appwrite.dart'; import 'package:appwrite/models.dart' as models; import 'package:communify_app/core/core.dart'; import 'package:communify_app/core/providers.dart'; import 'package:flutter_riverpod/flutter_riverpod.dart'; import 'package:fpdart/fpdart.dart';
final authAPIProvider = Provider((ref) { final account = ref.watch(appwriteAccountProvider); return AuthAPI(account: account); });
abstract class IAuthAPI { FutureEither<models.User> signUp({ required String email, required String password, }); }
class AuthAPI implements IAuthAPI { final Account _account;
AuthAPI({required Account account}) : _account = account;
@override FutureEither<models.User> signUp({ required String email, required String password, }) async { try { final models.User createdUser = await _account.create( userId: ID.unique(), email: email, password: password); return right(createdUser); } on AppwriteException catch (e, stackTrace) { return left( Failure(e.message ?? 'An unexpected error occurred', stackTrace), ); } catch (e, stackTrace) { return left( Failure(e.toString(), stackTrace), ); } } }
i used createdUser because the Appwrite updated their files and removed Account from models.dart
This is fine, I want to see the client code, how did you initalized the client object? And how are you passing it to the Account class
FYI, use three back ticks to format your code
sorry about this.
i've got an appwrite_client.dart file
import 'package:appwrite/appwrite.dart'; import 'package:communify_app/constants/appwrite_constants.dart';
class AppwriteClient { static late Client _client; static late Account account;
static void initialize() { _client = Client(); _client .setEndpoint(AppwriteConstants.endPoint) .setProject(AppwriteConstants.projectID);
account =
Account(_client); // Initializing the account instance with the client.
}
static Client get client => _client; }
just confirming again,
did you install appwrite on port 80? on localhost?
or there was another port used?
on my local env, I usually use some other port like:
static const String endPoint = 'http://localIpAddress:8990/v1';
i installed it on 80
localhost 80, yes correct
does using http://localhost open appwrite's dashboard on your browser? Chrome, Safari?
Yes it does.
opens up Brave (chrome)
even when i use my IP address, it opens up as well.
using the ip works on phone's browser to open the dashboard?
Yes it does.
Im trying to delete my Appwrite to start over.
But that also is giving me issues. Lol.
ash@lightone.io role(users) missing scope (users.write)
I think there is some issue with this code. I think your endpoint is not being set thus to this error. To confirm this , just add a breakpoint on whatever function you are executing (here signUp ig). And check for the value of host
Btw, it's best to use 3 back ticks with multi-line code. See https://www.markdownguide.org/extended-syntax/#syntax-highlighting
Recommended threads
- Attach Dart debugger for locally deploye...
Hello there, I was wondering if it is possible to attach debugger to dart function, that I run locally. It would make development much easier :-). Thank you.
- total parameter not working correctly in...
Hello Appwrite team, I'm experiencing issues with the total parameter in the listRows() method (TablesDB) across multiple SDKs. **Issue 1**: Node.js SDK (node...
- Relationship lists aren't showing
In flutter, when I perform a listRows function for my table which contains various relationships in addition to normal data, I am not getting the relationships ...