Files
Base-QR-FlutterApp/lib/models/login_response.dart
T
Alejandro Lara 50fe9a9d36 Initial commit: QR Scanner Flutter app
App móvil para validar pases QR contra base-admin-web con login Cognito,
escáner en tiempo real, feedback auditivo/háptico y README completo.
2026-06-09 17:03:06 -06:00

64 lines
1.7 KiB
Dart

class LoginResponse {
const LoginResponse({
required this.success,
this.accessToken,
this.refreshToken,
this.idToken,
this.tokenType,
this.expiresIn,
this.username,
this.roles = const [],
this.message,
});
factory LoginResponse.fromJson(Map<String, dynamic> json) {
return LoginResponse(
success: json['success'] == true,
accessToken: json['accessToken'] as String?,
refreshToken: json['refreshToken'] as String?,
idToken: json['idToken'] as String?,
tokenType: json['tokenType'] as String?,
expiresIn: (json['expiresIn'] as num?)?.toInt(),
username: json['username'] as String?,
roles: (json['roles'] as List<dynamic>?)
?.map((role) => role.toString())
.toList() ??
const [],
message: json['message'] as String?,
);
}
final bool success;
final String? accessToken;
final String? refreshToken;
final String? idToken;
final String? tokenType;
final int? expiresIn;
final String? username;
final List<String> roles;
final String? message;
LoginResponse copyWith({
bool? success,
String? accessToken,
String? refreshToken,
String? idToken,
String? tokenType,
int? expiresIn,
String? username,
List<String>? roles,
String? message,
}) {
return LoginResponse(
success: success ?? this.success,
accessToken: accessToken ?? this.accessToken,
refreshToken: refreshToken ?? this.refreshToken,
idToken: idToken ?? this.idToken,
tokenType: tokenType ?? this.tokenType,
expiresIn: expiresIn ?? this.expiresIn,
username: username ?? this.username,
roles: roles ?? this.roles,
message: message ?? this.message,
);
}
}