|
@@ -8,6 +8,9 @@ import 'package:domain/entity/auth_login_entity.dart';
|
|
import 'package:domain/entity/captcha_img_entity.dart';
|
|
import 'package:domain/entity/captcha_img_entity.dart';
|
|
import 'package:domain/entity/feedback_detail_entity.dart';
|
|
import 'package:domain/entity/feedback_detail_entity.dart';
|
|
import 'package:domain/entity/feedback_list_entity.dart';
|
|
import 'package:domain/entity/feedback_list_entity.dart';
|
|
|
|
+import 'package:domain/entity/form_list_entity.dart';
|
|
|
|
+import 'package:domain/entity/form_submitted_entity.dart';
|
|
|
|
+import 'package:domain/entity/form_submitted_page_entity.dart';
|
|
import 'package:domain/entity/id_name_entity.dart';
|
|
import 'package:domain/entity/id_name_entity.dart';
|
|
import 'package:domain/entity/newsfeed_comment_publish_entity.dart';
|
|
import 'package:domain/entity/newsfeed_comment_publish_entity.dart';
|
|
import 'package:domain/entity/newsfeed_following_entity.dart';
|
|
import 'package:domain/entity/newsfeed_following_entity.dart';
|
|
@@ -74,14 +77,12 @@ class JsonConvert {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- List<T?>? convertList<T>(List<dynamic>? value,
|
|
|
|
- {EnumConvertFunction? enumConvert}) {
|
|
|
|
|
|
+ List<T?>? convertList<T>(List<dynamic>? value, {EnumConvertFunction? enumConvert}) {
|
|
if (value == null) {
|
|
if (value == null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
- return value.map((dynamic e) => _asT<T>(e, enumConvert: enumConvert))
|
|
|
|
- .toList();
|
|
|
|
|
|
+ return value.map((dynamic e) => _asT<T>(e, enumConvert: enumConvert)).toList();
|
|
} catch (e, stackTrace) {
|
|
} catch (e, stackTrace) {
|
|
debugPrint('asT<$T> $e $stackTrace');
|
|
debugPrint('asT<$T> $e $stackTrace');
|
|
if (onError != null) {
|
|
if (onError != null) {
|
|
@@ -91,14 +92,12 @@ class JsonConvert {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- List<T>? convertListNotNull<T>(dynamic value,
|
|
|
|
- {EnumConvertFunction? enumConvert}) {
|
|
|
|
|
|
+ List<T>? convertListNotNull<T>(dynamic value, {EnumConvertFunction? enumConvert}) {
|
|
if (value == null) {
|
|
if (value == null) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
try {
|
|
try {
|
|
- return (value as List<dynamic>).map((dynamic e) =>
|
|
|
|
- _asT<T>(e, enumConvert: enumConvert)!).toList();
|
|
|
|
|
|
+ return (value as List<dynamic>).map((dynamic e) => _asT<T>(e, enumConvert: enumConvert)!).toList();
|
|
} catch (e, stackTrace) {
|
|
} catch (e, stackTrace) {
|
|
debugPrint('asT<$T> $e $stackTrace');
|
|
debugPrint('asT<$T> $e $stackTrace');
|
|
if (onError != null) {
|
|
if (onError != null) {
|
|
@@ -146,8 +145,7 @@ class JsonConvert {
|
|
return covertFunc(Map<String, dynamic>.from(value)) as T;
|
|
return covertFunc(Map<String, dynamic>.from(value)) as T;
|
|
}
|
|
}
|
|
} else {
|
|
} else {
|
|
- throw UnimplementedError(
|
|
|
|
- '$type unimplemented,you can try running the app again');
|
|
|
|
|
|
+ throw UnimplementedError('$type unimplemented,you can try running the app again');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
@@ -155,12 +153,10 @@ class JsonConvert {
|
|
//list is returned by type
|
|
//list is returned by type
|
|
static M? _getListChildType<M>(List<Map<String, dynamic>> data) {
|
|
static M? _getListChildType<M>(List<Map<String, dynamic>> data) {
|
|
if (<AuthLoginEntity>[] is M) {
|
|
if (<AuthLoginEntity>[] is M) {
|
|
- return data.map<AuthLoginEntity>((Map<String, dynamic> e) =>
|
|
|
|
- AuthLoginEntity.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<AuthLoginEntity>((Map<String, dynamic> e) => AuthLoginEntity.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<CaptchaImgEntity>[] is M) {
|
|
if (<CaptchaImgEntity>[] is M) {
|
|
- return data.map<CaptchaImgEntity>((Map<String, dynamic> e) =>
|
|
|
|
- CaptchaImgEntity.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<CaptchaImgEntity>((Map<String, dynamic> e) => CaptchaImgEntity.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<FeedbackDetailEntity>[] is M) {
|
|
if (<FeedbackDetailEntity>[] is M) {
|
|
return data.map<FeedbackDetailEntity>((Map<String, dynamic> e) => FeedbackDetailEntity.fromJson(e)).toList() as M;
|
|
return data.map<FeedbackDetailEntity>((Map<String, dynamic> e) => FeedbackDetailEntity.fromJson(e)).toList() as M;
|
|
@@ -174,97 +170,89 @@ class JsonConvert {
|
|
if (<FeedbackItemEntity>[] is M) {
|
|
if (<FeedbackItemEntity>[] is M) {
|
|
return data.map<FeedbackItemEntity>((Map<String, dynamic> e) => FeedbackItemEntity.fromJson(e)).toList() as M;
|
|
return data.map<FeedbackItemEntity>((Map<String, dynamic> e) => FeedbackItemEntity.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
|
|
+ if (<FormListEntity>[] is M) {
|
|
|
|
+ return data.map<FormListEntity>((Map<String, dynamic> e) => FormListEntity.fromJson(e)).toList() as M;
|
|
|
|
+ }
|
|
|
|
+ if (<FormSubmittedEntity>[] is M) {
|
|
|
|
+ return data.map<FormSubmittedEntity>((Map<String, dynamic> e) => FormSubmittedEntity.fromJson(e)).toList() as M;
|
|
|
|
+ }
|
|
|
|
+ if (<FormSubmittedContent>[] is M) {
|
|
|
|
+ return data.map<FormSubmittedContent>((Map<String, dynamic> e) => FormSubmittedContent.fromJson(e)).toList() as M;
|
|
|
|
+ }
|
|
|
|
+ if (<FormSubmittedEstateOnlineForm>[] is M) {
|
|
|
|
+ return data.map<FormSubmittedEstateOnlineForm>((Map<String, dynamic> e) => FormSubmittedEstateOnlineForm.fromJson(e)).toList() as M;
|
|
|
|
+ }
|
|
|
|
+ if (<FormSubmittedPageEntity>[] is M) {
|
|
|
|
+ return data.map<FormSubmittedPageEntity>((Map<String, dynamic> e) => FormSubmittedPageEntity.fromJson(e)).toList() as M;
|
|
|
|
+ }
|
|
if (<IdNameEntity>[] is M) {
|
|
if (<IdNameEntity>[] is M) {
|
|
- return data.map<IdNameEntity>((Map<String, dynamic> e) =>
|
|
|
|
- IdNameEntity.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<IdNameEntity>((Map<String, dynamic> e) => IdNameEntity.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<NewsfeedCommentPublishEntity>[] is M) {
|
|
if (<NewsfeedCommentPublishEntity>[] is M) {
|
|
- return data.map<NewsfeedCommentPublishEntity>((Map<String, dynamic> e) =>
|
|
|
|
- NewsfeedCommentPublishEntity.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<NewsfeedCommentPublishEntity>((Map<String, dynamic> e) => NewsfeedCommentPublishEntity.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<NewsfeedFollowingEntity>[] is M) {
|
|
if (<NewsfeedFollowingEntity>[] is M) {
|
|
- return data.map<NewsfeedFollowingEntity>((Map<String, dynamic> e) =>
|
|
|
|
- NewsfeedFollowingEntity.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<NewsfeedFollowingEntity>((Map<String, dynamic> e) => NewsfeedFollowingEntity.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<NewsfeedFollowingList>[] is M) {
|
|
if (<NewsfeedFollowingList>[] is M) {
|
|
- return data.map<NewsfeedFollowingList>((Map<String, dynamic> e) =>
|
|
|
|
- NewsfeedFollowingList.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<NewsfeedFollowingList>((Map<String, dynamic> e) => NewsfeedFollowingList.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<NewsfeedFollowingListAccount>[] is M) {
|
|
if (<NewsfeedFollowingListAccount>[] is M) {
|
|
- return data.map<NewsfeedFollowingListAccount>((Map<String, dynamic> e) =>
|
|
|
|
- NewsfeedFollowingListAccount.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<NewsfeedFollowingListAccount>((Map<String, dynamic> e) => NewsfeedFollowingListAccount.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<NewsfeedForyouEntity>[] is M) {
|
|
if (<NewsfeedForyouEntity>[] is M) {
|
|
- return data.map<NewsfeedForyouEntity>((Map<String, dynamic> e) =>
|
|
|
|
- NewsfeedForyouEntity.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<NewsfeedForyouEntity>((Map<String, dynamic> e) => NewsfeedForyouEntity.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<NewsfeedForyouList>[] is M) {
|
|
if (<NewsfeedForyouList>[] is M) {
|
|
- return data.map<NewsfeedForyouList>((Map<String, dynamic> e) =>
|
|
|
|
- NewsfeedForyouList.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<NewsfeedForyouList>((Map<String, dynamic> e) => NewsfeedForyouList.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<NewsfeedForyouListAccount>[] is M) {
|
|
if (<NewsfeedForyouListAccount>[] is M) {
|
|
- return data.map<NewsfeedForyouListAccount>((Map<String, dynamic> e) =>
|
|
|
|
- NewsfeedForyouListAccount.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<NewsfeedForyouListAccount>((Map<String, dynamic> e) => NewsfeedForyouListAccount.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<NewsfeedNewsEntity>[] is M) {
|
|
if (<NewsfeedNewsEntity>[] is M) {
|
|
- return data.map<NewsfeedNewsEntity>((Map<String, dynamic> e) =>
|
|
|
|
- NewsfeedNewsEntity.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<NewsfeedNewsEntity>((Map<String, dynamic> e) => NewsfeedNewsEntity.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<NewsfeedNewsList>[] is M) {
|
|
if (<NewsfeedNewsList>[] is M) {
|
|
- return data.map<NewsfeedNewsList>((Map<String, dynamic> e) =>
|
|
|
|
- NewsfeedNewsList.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<NewsfeedNewsList>((Map<String, dynamic> e) => NewsfeedNewsList.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<NewsfeedNewsListAccount>[] is M) {
|
|
if (<NewsfeedNewsListAccount>[] is M) {
|
|
- return data.map<NewsfeedNewsListAccount>((Map<String, dynamic> e) =>
|
|
|
|
- NewsfeedNewsListAccount.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<NewsfeedNewsListAccount>((Map<String, dynamic> e) => NewsfeedNewsListAccount.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<PropertyNewsEntity>[] is M) {
|
|
if (<PropertyNewsEntity>[] is M) {
|
|
- return data.map<PropertyNewsEntity>((Map<String, dynamic> e) =>
|
|
|
|
- PropertyNewsEntity.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<PropertyNewsEntity>((Map<String, dynamic> e) => PropertyNewsEntity.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<PropertyNewsList>[] is M) {
|
|
if (<PropertyNewsList>[] is M) {
|
|
- return data.map<PropertyNewsList>((Map<String, dynamic> e) =>
|
|
|
|
- PropertyNewsList.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<PropertyNewsList>((Map<String, dynamic> e) => PropertyNewsList.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<PropertySaleRentEntity>[] is M) {
|
|
if (<PropertySaleRentEntity>[] is M) {
|
|
- return data.map<PropertySaleRentEntity>((Map<String, dynamic> e) =>
|
|
|
|
- PropertySaleRentEntity.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<PropertySaleRentEntity>((Map<String, dynamic> e) => PropertySaleRentEntity.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<PropertySaleRentList>[] is M) {
|
|
if (<PropertySaleRentList>[] is M) {
|
|
- return data.map<PropertySaleRentList>((Map<String, dynamic> e) =>
|
|
|
|
- PropertySaleRentList.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<PropertySaleRentList>((Map<String, dynamic> e) => PropertySaleRentList.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<ServerTime>[] is M) {
|
|
if (<ServerTime>[] is M) {
|
|
- return data.map<ServerTime>((Map<String, dynamic> e) =>
|
|
|
|
- ServerTime.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<ServerTime>((Map<String, dynamic> e) => ServerTime.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<UserMeEntity>[] is M) {
|
|
if (<UserMeEntity>[] is M) {
|
|
- return data.map<UserMeEntity>((Map<String, dynamic> e) =>
|
|
|
|
- UserMeEntity.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<UserMeEntity>((Map<String, dynamic> e) => UserMeEntity.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<UserMeHouseholds>[] is M) {
|
|
if (<UserMeHouseholds>[] is M) {
|
|
- return data.map<UserMeHouseholds>((Map<String, dynamic> e) =>
|
|
|
|
- UserMeHouseholds.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<UserMeHouseholds>((Map<String, dynamic> e) => UserMeHouseholds.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<UserMeEstates>[] is M) {
|
|
if (<UserMeEstates>[] is M) {
|
|
- return data.map<UserMeEstates>((Map<String, dynamic> e) =>
|
|
|
|
- UserMeEstates.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<UserMeEstates>((Map<String, dynamic> e) => UserMeEstates.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<UserMeEstatesAccounts>[] is M) {
|
|
if (<UserMeEstatesAccounts>[] is M) {
|
|
- return data.map<UserMeEstatesAccounts>((Map<String, dynamic> e) =>
|
|
|
|
- UserMeEstatesAccounts.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<UserMeEstatesAccounts>((Map<String, dynamic> e) => UserMeEstatesAccounts.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<UserMeEstatesAccountsUnit>[] is M) {
|
|
if (<UserMeEstatesAccountsUnit>[] is M) {
|
|
- return data.map<UserMeEstatesAccountsUnit>((Map<String, dynamic> e) =>
|
|
|
|
- UserMeEstatesAccountsUnit.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<UserMeEstatesAccountsUnit>((Map<String, dynamic> e) => UserMeEstatesAccountsUnit.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<UserMeDefaultUnit>[] is M) {
|
|
if (<UserMeDefaultUnit>[] is M) {
|
|
- return data.map<UserMeDefaultUnit>((Map<String, dynamic> e) =>
|
|
|
|
- UserMeDefaultUnit.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<UserMeDefaultUnit>((Map<String, dynamic> e) => UserMeDefaultUnit.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
if (<UserMeInformation>[] is M) {
|
|
if (<UserMeInformation>[] is M) {
|
|
- return data.map<UserMeInformation>((Map<String, dynamic> e) =>
|
|
|
|
- UserMeInformation.fromJson(e)).toList() as M;
|
|
|
|
|
|
+ return data.map<UserMeInformation>((Map<String, dynamic> e) => UserMeInformation.fromJson(e)).toList() as M;
|
|
}
|
|
}
|
|
|
|
|
|
debugPrint("$M not found");
|
|
debugPrint("$M not found");
|
|
@@ -277,8 +265,7 @@ class JsonConvert {
|
|
return json;
|
|
return json;
|
|
}
|
|
}
|
|
if (json is List) {
|
|
if (json is List) {
|
|
- return _getListChildType<M>(
|
|
|
|
- json.map((dynamic e) => e as Map<String, dynamic>).toList());
|
|
|
|
|
|
+ return _getListChildType<M>(json.map((dynamic e) => e as Map<String, dynamic>).toList());
|
|
} else {
|
|
} else {
|
|
return jsonConvert.convert<M>(json);
|
|
return jsonConvert.convert<M>(json);
|
|
}
|
|
}
|
|
@@ -293,13 +280,16 @@ class JsonConvertClassCollection {
|
|
(FeedbackDetailReplies).toString(): FeedbackDetailReplies.fromJson,
|
|
(FeedbackDetailReplies).toString(): FeedbackDetailReplies.fromJson,
|
|
(FeedbackListEntity).toString(): FeedbackListEntity.fromJson,
|
|
(FeedbackListEntity).toString(): FeedbackListEntity.fromJson,
|
|
(FeedbackItemEntity).toString(): FeedbackItemEntity.fromJson,
|
|
(FeedbackItemEntity).toString(): FeedbackItemEntity.fromJson,
|
|
|
|
+ (FormListEntity).toString(): FormListEntity.fromJson,
|
|
|
|
+ (FormSubmittedEntity).toString(): FormSubmittedEntity.fromJson,
|
|
|
|
+ (FormSubmittedContent).toString(): FormSubmittedContent.fromJson,
|
|
|
|
+ (FormSubmittedEstateOnlineForm).toString(): FormSubmittedEstateOnlineForm.fromJson,
|
|
|
|
+ (FormSubmittedPageEntity).toString(): FormSubmittedPageEntity.fromJson,
|
|
(IdNameEntity).toString(): IdNameEntity.fromJson,
|
|
(IdNameEntity).toString(): IdNameEntity.fromJson,
|
|
- (NewsfeedCommentPublishEntity).toString(): NewsfeedCommentPublishEntity
|
|
|
|
- .fromJson,
|
|
|
|
|
|
+ (NewsfeedCommentPublishEntity).toString(): NewsfeedCommentPublishEntity.fromJson,
|
|
(NewsfeedFollowingEntity).toString(): NewsfeedFollowingEntity.fromJson,
|
|
(NewsfeedFollowingEntity).toString(): NewsfeedFollowingEntity.fromJson,
|
|
(NewsfeedFollowingList).toString(): NewsfeedFollowingList.fromJson,
|
|
(NewsfeedFollowingList).toString(): NewsfeedFollowingList.fromJson,
|
|
- (NewsfeedFollowingListAccount).toString(): NewsfeedFollowingListAccount
|
|
|
|
- .fromJson,
|
|
|
|
|
|
+ (NewsfeedFollowingListAccount).toString(): NewsfeedFollowingListAccount.fromJson,
|
|
(NewsfeedForyouEntity).toString(): NewsfeedForyouEntity.fromJson,
|
|
(NewsfeedForyouEntity).toString(): NewsfeedForyouEntity.fromJson,
|
|
(NewsfeedForyouList).toString(): NewsfeedForyouList.fromJson,
|
|
(NewsfeedForyouList).toString(): NewsfeedForyouList.fromJson,
|
|
(NewsfeedForyouListAccount).toString(): NewsfeedForyouListAccount.fromJson,
|
|
(NewsfeedForyouListAccount).toString(): NewsfeedForyouListAccount.fromJson,
|