// To parse this JSON data, do // // final jwtDecodedData = jwtDecodedDataFromJson(jsonString); import 'dart:convert'; JwtDecodedData jwtDecodedDataFromJson(String str) => JwtDecodedData.fromJson(json.decode(str)); String jwtDecodedDataToJson(JwtDecodedData data) => json.encode(data.toJson()); class JwtDecodedData { String? authType; String? deviceCode; int? deviceId; String? deviceRole; String? eventName; String? oId; List? oIds; String? organizerId; JwtDecodedData({ this.authType, this.deviceCode, this.deviceId, this.deviceRole, this.eventName, this.oId, this.oIds, this.organizerId, }); factory JwtDecodedData.fromJson(Map json) => JwtDecodedData( authType: json['authType']?.toString(), deviceCode: json['deviceCode']?.toString(), deviceId: _readInt(json['deviceId']), deviceRole: json['deviceRole']?.toString(), eventName: json['eventName']?.toString(), oId: json['oId']?.toString(), oIds: json['oIds'] == null ? [] : List.from(json['oIds']!.map((x) => x?.toString())), organizerId: json['organizerId']?.toString(), ); Map toJson() => { 'authType': authType, 'deviceCode': deviceCode, 'deviceId': deviceId, 'deviceRole': deviceRole, 'eventName': eventName, 'oId': oId, 'oIds': oIds == null ? [] : List.from(oIds!.map((x) => x)), 'organizerId': organizerId, }; } int? _readInt(dynamic value) { if (value == null) return null; if (value is int) return value; if (value is num) return value.toInt(); return int.tryParse(value.toString()); }