Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code not working properly with Appwrite 9.0.1 #3

Open
rsbichkar opened this issue Jul 31, 2023 · 4 comments
Open

Code not working properly with Appwrite 9.0.1 #3

rsbichkar opened this issue Jul 31, 2023 · 4 comments

Comments

@rsbichkar
Copy link

rsbichkar commented Jul 31, 2023

Hi,
Thank you very much for this flutter twitter clone. I am learning to use Riverpod with AppWrite from your project.

However, I faced some issues while working with Appwrite 9 version in Flutter 3.10.6 (latest stable version). I am currently using Appwrite 1.3.8 local version. Also tested it with AppWrite Cloud. The model.Account was replaced by model.User in AuthAPI and AuthController files. Also the stack trace demangling was used.

void main() {
  runApp(
    const ProviderScope(
      child: MyApp(),
    ),
  );
  FlutterError.demangleStackTrace = (StackTrace stack) {
    if (stack is stack_trace.Trace) return stack.vmTrace;
    if (stack is stack_trace.Chain) return stack.toTrace().vmTrace;
    return stack;
  };
}

The issues faced are as follows:

  1. After a user logs out and another user logs in the profile page still shows the old user which is also used for the Tweets
  2. The error 'Null check operator used on a null value' is thrown for the following line in currentUserDetailsProvider definition:
  final currentUserId = ref.watch(currentUserAccountProvider).value!.$id;
  1. Also Realtime subscription is lost
flutter: subscription: ws://192.168.1.148:4003/v1/realtime?project=64b3ea1af0287f509fa5&channels%5B%5D=databases.64b3ecdbe0aea219dd76.collections.64c4cdd09a56cf2bd378.documents
flutter: subscription: null
@muhammadolammi
Copy link

I got the same issue but it's working with this code.
final getCurrentUserDataProvider = FutureProvider((ref) async {
final userId = ref.watch(currentUserAccountProvider).value?.$id;
final getUserData = ref.watch(getUserDataProvider(userId));
return getUserData.asData?.value;
});

although there's no error, the loading page still keep loading unless I use the flutter reload.

@Sharma-Shivam2021
Copy link

I got the same issue but it's working with this code. final getCurrentUserDataProvider = FutureProvider((ref) async { final userId = ref.watch(currentUserAccountProvider).value?.$id; final getUserData = ref.watch(getUserDataProvider(userId)); return getUserData.asData?.value; });

although there's no error, the loading page still keep loading unless I use the flutter reload.

It's not working for me. I am still getting Null check operator used on null value for first time. and after hot reload it goes back

@taylanozgurertas
Copy link

has this problem been solved? if resolved can someone explain pls

The error 'Null check operator used on a null value' is thrown for the following line in currentUserDetailsProvider definition:
final currentUserId = ref.watch(currentUserAccountProvider).value!.$id;

@taylanozgurertas
Copy link

taylanozgurertas commented Apr 25, 2024

okay I solved like this.

final currentUserDetailsProvider = FutureProvider((ref) async { final authController = ref.watch(authControllerProvider.notifier); final current = await authController.currentUser(); if (current == null) { } else { final currentUserId = current.$id; final userDetails = ref.watch(userDetailsProvider(currentUserId)); return userDetails.value; } });

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants