claude refactorings, flutter best practices, platform dependent changes, general cleanup
This commit is contained in:
+7
-4
@@ -3,9 +3,9 @@ import 'dart:convert';
|
||||
import 'package:http/http.dart' as http;
|
||||
import 'package:http/http.dart';
|
||||
|
||||
import '../talkApi.dart';
|
||||
import 'getChatParams.dart';
|
||||
import 'getChatResponse.dart';
|
||||
import '../talk_api.dart';
|
||||
import 'get_chat_params.dart';
|
||||
import 'get_chat_response.dart';
|
||||
|
||||
class GetChat extends TalkApi<GetChatResponse> {
|
||||
String chatToken;
|
||||
@@ -14,7 +14,10 @@ class GetChat extends TalkApi<GetChatResponse> {
|
||||
GetChat(this.chatToken, this.params) : super('v1/chat/$chatToken', null, getParameters: params.toJson());
|
||||
|
||||
@override
|
||||
assemble(String raw) => GetChatResponse.fromJson(jsonDecode(raw)['ocs']);
|
||||
GetChatResponse assemble(String raw) {
|
||||
final decoded = jsonDecode(raw) as Map<String, dynamic>;
|
||||
return GetChatResponse.fromJson(decoded['ocs'] as Map<String, dynamic>);
|
||||
}
|
||||
|
||||
@override
|
||||
Future<Response> request(Uri uri, Object? body, Map<String, String>? headers) => http.get(uri, headers: headers);
|
||||
+4
-4
@@ -1,7 +1,7 @@
|
||||
import '../../../requestCache.dart';
|
||||
import 'getChat.dart';
|
||||
import 'getChatParams.dart';
|
||||
import 'getChatResponse.dart';
|
||||
import '../../../request_cache.dart';
|
||||
import 'get_chat.dart';
|
||||
import 'get_chat_params.dart';
|
||||
import 'get_chat_response.dart';
|
||||
|
||||
class GetChatCache extends SimpleCache<GetChatResponse> {
|
||||
GetChatCache({
|
||||
+2
-2
@@ -1,8 +1,8 @@
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../../../apiParams.dart';
|
||||
import '../../../api_params.dart';
|
||||
|
||||
part 'getChatParams.g.dart';
|
||||
part 'get_chat_params.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true, includeIfNull: false)
|
||||
class GetChatParams extends ApiParams {
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'getChatParams.dart';
|
||||
part of 'get_chat_params.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
+7
-7
@@ -1,10 +1,10 @@
|
||||
import 'package:jiffy/jiffy.dart';
|
||||
import 'package:json_annotation/json_annotation.dart';
|
||||
|
||||
import '../../../apiResponse.dart';
|
||||
import '../room/getRoomResponse.dart';
|
||||
import '../../../api_response.dart';
|
||||
import '../room/get_room_response.dart';
|
||||
|
||||
part 'getChatResponse.g.dart';
|
||||
part 'get_chat_response.g.dart';
|
||||
|
||||
@JsonSerializable(explicitToJson: true)
|
||||
class GetChatResponse extends ApiResponse {
|
||||
@@ -87,10 +87,10 @@ class GetChatResponseObject {
|
||||
}
|
||||
|
||||
Map<String, RichObjectString>? _fromJson(dynamic json) {
|
||||
if(json is Map<String, dynamic>) {
|
||||
var data = <String, RichObjectString>{};
|
||||
for (var element in json.keys) {
|
||||
data.putIfAbsent(element, () => RichObjectString.fromJson(json[element]));
|
||||
if (json is Map<String, dynamic>) {
|
||||
final data = <String, RichObjectString>{};
|
||||
for (final element in json.keys) {
|
||||
data.putIfAbsent(element, () => RichObjectString.fromJson(json[element] as Map<String, dynamic>));
|
||||
}
|
||||
return data;
|
||||
}
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
// GENERATED CODE - DO NOT MODIFY BY HAND
|
||||
|
||||
part of 'getChatResponse.dart';
|
||||
part of 'get_chat_response.dart';
|
||||
|
||||
// **************************************************************************
|
||||
// JsonSerializableGenerator
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
|
||||
import 'getChatResponse.dart';
|
||||
import 'get_chat_response.dart';
|
||||
|
||||
class RichObjectStringProcessor {
|
||||
static String parseToString(String message, Map<String, RichObjectString>? data) {
|
||||
Reference in New Issue
Block a user