hosteday_flutter 1.0.5
hosteday_flutter: ^1.0.5 copied to clipboard
A lightweight Flutter SDK for connecting apps with HosteDay APIs, including authentication, user requests, custom endpoints, and realtime support.
Changelog #
All notable changes to hosteday_flutter will be documented in this file.
The format is based on Keep a Changelog, and this project follows Semantic Versioning.
1.0.5 - 2026-06-22 #
Added #
- Added a Firebase-inspired authentication layer through
HosteDayAuth. - Added
HosteDayUser,HosteDaySession, andHosteDayUserCredential. - Added
HosteDayAuthExceptionfor authentication-specific failures. - Added
HosteDayAuthStorageandMemoryHosteDayAuthStorage. - Added automatic session restoration during SDK initialization.
- Added automatic access-token handling for authenticated HTTP requests and private Realtime channels.
- Added authentication state streams:
authStateChanges()idTokenChanges()userChanges()
- Added authentication methods:
signInWithEmailAndPassword(...)createUserWithEmailAndPassword(...)signOut()sendPasswordResetEmail(...)confirmPasswordReset(...)reload()updateProfile(...)sendEmailVerification()
- Added HTTP convenience methods to
HosteDayHttpClient:get(...)post(...)put(...)patch(...)delete(...)
- Added
HosteDayConfig.realtimeUrl.
Changed #
- Renamed the official SDK entry point from
HostedaytoHosteDay. - Added
HosteDay.authas the central authentication API. - Updated
HosteDayClientto manage auth, HTTP, and Realtime through a shared dynamic token provider. - Protected requests using
withAuth: truenow automatically use the active authenticated session token. - Private, presence, and private encrypted channels now automatically use the current authentication session token.
- SDK initialization now restores the persisted local session before returning.
- Realtime now uses
wssand port443by default when no custom values are supplied. - Added
HosteDay.config.realtimeUrlfor the complete WebSocket endpoint.
Deprecated #
- Deprecated
Hosteday. - Use
HosteDay.initializeApp(...),HosteDay.client,HosteDay.config, andHosteDay.authin all new projects. - Manual token extraction and manual bearer-token state management are no longer recommended after
using
HosteDayAuth.
Fixed #
- Fixed missing
get,post,put,patch, anddeletemethods inHosteDayHttpClient. - Fixed token synchronization between authenticated API requests and Realtime channel authorization.
- Fixed local session cleanup when remote logout fails.
Migration Guide #
Before
final tokenProvider = StaticHosteDayTokenProvider(token);
await
Hosteday.initializeApp
(
options: {
'project_domain': 'example.hosteday.com',
},
tokenProvider: tokenProvider,
);
final response = await Hosteday.client.post(
Hosteday.config.loginPathPost,
body: {
'email': email,
'password': password,
},
);
final token = response['token'];
await Hosteday.client.get(
'/api/user',
withAuth: true,
);
After
await
HosteDay.initializeApp
(
options: {
'project_domain': 'example.hosteday.com',
},
);
final credential = await HosteDay.auth.signInWithEmailAndPassword(
email: email,
password: password,
);
final user = credential.user;
final response = await HosteDay.client.get(
'/api/user',
withAuth: true,
);
The authenticated access token is now stored and used internally by the SDK.
Authentication State
HosteDay.auth.authStateChanges
().listen
(
(user) {
if (user == null) {
print('Signed out');
return;
}
print('Signed in as ${user.email}');
});
Private Realtime Channel
await
HosteDay.connectRealtime
();
await
HosteDay.client.realtime.listenPrivate
(
channel: 'tenant.chat.room.1',
event: 'message.sent',
onEvent: (event) {
print(event.payload);
},
);
No manual Bearer token handling is required after successful sign-in.
Backend Response Requirements #
The login and registration endpoints should return a session response containing a user and access token.
Recommended response format:
{
"access_token": "1|example-token",
"token_type": "Bearer",
"expires_in": null,
"user": {
"id": 1,
"name": "Mustafa",
"email": "mustafa@example.com",
"email_verified": true,
"avatar_url": null
}
}
The SDK also supports common alternative response shapes such as:
{
"token": "1|example-token",
"user": {
"id": 1,
"name": "Mustafa",
"email": "mustafa@example.com"
}
}
or:
{
"data": {
"access_token": "1|example-token",
"user": {
"id": 1,
"name": "Mustafa",
"email": "mustafa@example.com"
}
}
}
Notes #
MemoryHosteDayAuthStorageis suitable only for tests, demos, and temporary sessions.- Production applications should provide an implementation of
HosteDayAuthStoragebacked by secure persistent storage. - A future release may provide an official secure storage adapter for Flutter.
Hostedaywill be removed in a future major release. UseHosteDayin all new projects.