Skip to main content

Create a client

String
required
Base URL of the Era service.
String
required
Publishable key for mobile identity and verification requests.
http.Client
Custom HTTP client. The SDK creates one when omitted.
bool
default:"false"
Close the supplied httpClient when close() is called.
EraFlutterStorage
Custom visitor storage. The default uses SharedPreferencesAsync.
See all Flutter SDK types.

init([visitorId])

Loads the stored visitor or creates one.
Pass a lowercase UUIDv4 when your application already has a visitor UUID:

getVisitorId()

Reads the current visitor without creating one.
Returns the stored or in-memory visitor, or null when none exists.

getVerification()

Checks whether the current visitor is linked to an Era end user.
eraEndUserId is an opaque Era ID or null.

startVerification(type, identifier)

Sends an email or phone verification code.

confirmVerification(challengeId, code)

Confirms a code and links the current visitor.

resendVerification(challengeId)

Sends another code.
Use the returned challenge for later confirm or resend calls.

resetVisitor()

Replaces the current visitor and returns the new ID.
Use this after logout, account switching, or a shared-device user change.

close()

Aborts this client’s requests and closes its owned HTTP client.
Calling close() more than once has no effect. Other methods throw client_closed after the client is closed. See Flutter SDK errors.