supabase / gotrue-dart

A dart client library for GoTrue.
MIT License
46 stars 37 forks source link

type `Null` is not a subtype of type `Map<String, dynamic>` in type cast #77

Closed DanMossa closed 2 years ago

DanMossa commented 2 years ago

When calling signUpWithEmail, I occasionally get a TypeError.

This is the line of code that's throwing: final data = response.rawData as Map<String, dynamic>;

And the location is here https://github.com/supabase-community/gotrue-dart/blob/3c1e471ea433af453811ba1b8315ffce8e993564/lib/src/gotrue_api.dart#L48

It happens when I run this method a second time right after this first.

This is: response.rawData.

{
    error: GotrueError(message: For security purposes, you can only request this after 28 seconds.),
    rawData: null,
}

The Try block then catches the type error and returns the TypeError message, not the actual rate limit error.

DanMossa commented 2 years ago

I'm using an old version of gotrue