From e23f2636b03d0856e016f0008e2f23b774ba5f81 Mon Sep 17 00:00:00 2001 From: Reza <94842463+Reza-deriv@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:07:39 +0800 Subject: [PATCH 1/7] fix issues in package --- example/lib/blocs/active_symbols/active_symbols_bloc.dart | 2 +- .../blocs/available_contracts/available_contracts_bloc.dart | 2 ++ lib/api/response/p2p_advert_create_response_result.dart | 6 +++++- lib/api/response/p2p_advert_list_response_result.dart | 2 +- test/api/account/authorize/authorize_test.dart | 1 + .../account/new_account_wallet/new_account_wallet_test.dart | 5 +++++ test/api/common/active_symbols/active_symbols_test.dart | 1 + 7 files changed, 16 insertions(+), 3 deletions(-) diff --git a/example/lib/blocs/active_symbols/active_symbols_bloc.dart b/example/lib/blocs/active_symbols/active_symbols_bloc.dart index 0d28ae0db2..3b784534c7 100644 --- a/example/lib/blocs/active_symbols/active_symbols_bloc.dart +++ b/example/lib/blocs/active_symbols/active_symbols_bloc.dart @@ -51,6 +51,6 @@ class ActiveSymbolsBloc extends Bloc { Future _fetchActiveSymbols() async => ActiveSymbolsResponse.fetchActiveSymbols(const ActiveSymbolsRequest( activeSymbols: 'brief', - productType: 'basic', + productType: 'basic', landingCompany: '', )); } diff --git a/example/lib/blocs/available_contracts/available_contracts_bloc.dart b/example/lib/blocs/available_contracts/available_contracts_bloc.dart index 47e631784a..3a4ef898d0 100644 --- a/example/lib/blocs/available_contracts/available_contracts_bloc.dart +++ b/example/lib/blocs/available_contracts/available_contracts_bloc.dart @@ -9,6 +9,7 @@ import 'package:flutter_deriv_api/basic_api/generated/api.dart'; import '../active_symbols/active_symbols_bloc.dart'; part 'available_contracts_event.dart'; + part 'available_contracts_state.dart'; /// AvailableContractsBloc @@ -75,5 +76,6 @@ class AvailableContractsBloc ) async => ContractsForResponse.fetchContractsForSymbol(ContractsForRequest( contractsFor: selectedSymbol?.symbol, + landingCompany: '', )); } diff --git a/lib/api/response/p2p_advert_create_response_result.dart b/lib/api/response/p2p_advert_create_response_result.dart index cae00b3e42..1467f21aac 100644 --- a/lib/api/response/p2p_advert_create_response_result.dart +++ b/lib/api/response/p2p_advert_create_response_result.dart @@ -1,8 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; -import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_create_send.dart'; @@ -221,6 +221,7 @@ enum VisibilityStatusItemEnum { /// advertiser_temp_ban. advertiserTempBan, } + /// P2p advert create model class. abstract class P2pAdvertCreateModel { /// Initializes P2p advert create model class . @@ -720,6 +721,7 @@ class P2pAdvertCreate extends P2pAdvertCreateModel { visibilityStatus: visibilityStatus ?? this.visibilityStatus, ); } + /// Advertiser details model class. abstract class AdvertiserDetailsModel { /// Initializes Advertiser details model class . @@ -861,6 +863,7 @@ class AdvertiserDetails extends AdvertiserDetailsModel { totalCompletionRate: totalCompletionRate ?? this.totalCompletionRate, ); } + /// Payment method details property model class. abstract class PaymentMethodDetailsPropertyModel { /// Initializes Payment method details property model class . @@ -989,6 +992,7 @@ class PaymentMethodDetailsProperty extends PaymentMethodDetailsPropertyModel { usedByOrders: usedByOrders ?? this.usedByOrders, ); } + /// Fields property model class. abstract class FieldsPropertyModel { /// Initializes Fields property model class . diff --git a/lib/api/response/p2p_advert_list_response_result.dart b/lib/api/response/p2p_advert_list_response_result.dart index d3dc565671..e5aec1c717 100644 --- a/lib/api/response/p2p_advert_list_response_result.dart +++ b/lib/api/response/p2p_advert_list_response_result.dart @@ -1,8 +1,8 @@ // ignore_for_file: prefer_single_quotes, unnecessary_import, unused_import import 'package:equatable/equatable.dart'; +import 'package:flutter_deriv_api/api/exceptions/base_api_exception.dart'; -import 'package:flutter_deriv_api/api/exceptions/p2p_advert_exception.dart'; import 'package:flutter_deriv_api/api/models/base_exception_model.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_receive.dart'; import 'package:flutter_deriv_api/basic_api/generated/p2p_advert_list_send.dart'; diff --git a/test/api/account/authorize/authorize_test.dart b/test/api/account/authorize/authorize_test.dart index 4a384c446f..20ef537d00 100644 --- a/test/api/account/authorize/authorize_test.dart +++ b/test/api/account/authorize/authorize_test.dart @@ -20,6 +20,7 @@ void main() { const AuthorizeRequest( authorize: 'sample_token_334da73d', addToLoginHistory: true, + tokens: [], ), ); diff --git a/test/api/account/new_account_wallet/new_account_wallet_test.dart b/test/api/account/new_account_wallet/new_account_wallet_test.dart index e3a990eea8..a4fa152a3e 100644 --- a/test/api/account/new_account_wallet/new_account_wallet_test.dart +++ b/test/api/account/new_account_wallet/new_account_wallet_test.dart @@ -17,6 +17,11 @@ void main() { request: const NewAccountWalletRequest( accountType: 'crypto', currency: 'BTC', + acceptRisk: null, + financialAssessment: {}, + salutation: '', + taxIdentificationNumber: '', + taxResidence: '', ), ); diff --git a/test/api/common/active_symbols/active_symbols_test.dart b/test/api/common/active_symbols/active_symbols_test.dart index bfde84029a..fecbca988c 100644 --- a/test/api/common/active_symbols/active_symbols_test.dart +++ b/test/api/common/active_symbols/active_symbols_test.dart @@ -16,6 +16,7 @@ void main() { const ActiveSymbolsRequest( activeSymbols: 'brief', productType: 'basic', + landingCompany: '', ), ); From 4ed460798a9671f7c36d274dd0a9097718356a41 Mon Sep 17 00:00:00 2001 From: Reza <94842463+Reza-deriv@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:21:30 +0800 Subject: [PATCH 2/7] allow null value in requests --- lib/services/connection/api_manager/base_api.dart | 2 +- lib/services/connection/api_manager/binary_api.dart | 3 ++- lib/services/connection/api_manager/mock_api.dart | 2 +- .../connection/call_manager/base_call_manager.dart | 5 ++++- .../connection/call_manager/call_manager.dart | 5 +++-- .../connection/call_manager/subscription_manager.dart | 11 ++++++----- .../services/call_manager/base_call_manager_test.dart | 5 +++-- 7 files changed, 20 insertions(+), 13 deletions(-) diff --git a/lib/services/connection/api_manager/base_api.dart b/lib/services/connection/api_manager/base_api.dart index 8cc480351a..5588a0c9d1 100644 --- a/lib/services/connection/api_manager/base_api.dart +++ b/lib/services/connection/api_manager/base_api.dart @@ -33,7 +33,7 @@ abstract class BaseAPI { void addToChannel(Map request); /// Calls a API method by [request]. - Future call({required Request request}); + Future call({required Request request, bool acceptNullValue = false}); /// Subscribe to a [request]. /// [comparePredicate] indicates compare condition for current [request] and [pendingRequest]s diff --git a/lib/services/connection/api_manager/binary_api.dart b/lib/services/connection/api_manager/binary_api.dart index 43b58c060c..55641c2c43 100644 --- a/lib/services/connection/api_manager/binary_api.dart +++ b/lib/services/connection/api_manager/binary_api.dart @@ -139,7 +139,8 @@ class BinaryAPI extends BaseAPI { } @override - Future call({required Request request}) async { + Future call( + {required Request request, bool acceptNullValue = false}) async { final Response response = await (_callManager ??= CallManager(this))( request: request, ); diff --git a/lib/services/connection/api_manager/mock_api.dart b/lib/services/connection/api_manager/mock_api.dart index 15e702553a..7dc05ad931 100644 --- a/lib/services/connection/api_manager/mock_api.dart +++ b/lib/services/connection/api_manager/mock_api.dart @@ -130,7 +130,7 @@ class MockAPI extends BaseAPI { void addToChannel(Map request) {} @override - Future call({required Request request}) => + Future call({required Request request, bool acceptNullValue = false}) => _getFutureResponse(request); @override diff --git a/lib/services/connection/call_manager/base_call_manager.dart b/lib/services/connection/call_manager/base_call_manager.dart index b813ae87e5..64e5091ba2 100644 --- a/lib/services/connection/call_manager/base_call_manager.dart +++ b/lib/services/connection/call_manager/base_call_manager.dart @@ -43,7 +43,7 @@ abstract class BaseCallManager { bool contains(int? requestId) => _pendingRequests.containsKey(requestId); /// Calls a API method by [request] - T call({required Request request}); + T call({required Request request, bool acceptNullValue = false}); /// Handle call [response] that comes from server void handleResponse({ @@ -62,12 +62,14 @@ abstract class BaseCallManager { Future addToChannel({ required Request request, SubscriptionStream? subscriptionStream, + bool acceptNullValue = false, }) { final Completer responseCompleter = Completer(); final Request requestWithId = request.copyWith(reqId: _getRequestId()); final Map prepareRequest = _prepareRequest( request: requestWithId, isSubscription: subscriptionStream != null, + acceptNullValue: acceptNullValue, ); _addPendingRequest( @@ -104,6 +106,7 @@ abstract class BaseCallManager { Map _prepareRequest({ required Request request, required bool isSubscription, + bool acceptNullValue = false, }) { final Map result = request.toJson() ..removeWhere((String key, dynamic value) => value == null); diff --git a/lib/services/connection/call_manager/call_manager.dart b/lib/services/connection/call_manager/call_manager.dart index 99d1400bf1..a225c4057c 100644 --- a/lib/services/connection/call_manager/call_manager.dart +++ b/lib/services/connection/call_manager/call_manager.dart @@ -29,6 +29,7 @@ class CallManager extends BaseCallManager> { } @override - Future call({required Request request}) async => - addToChannel(request: request); + Future call( + {required Request request, bool acceptNullValue = false}) async => + addToChannel(request: request, acceptNullValue: acceptNullValue); } diff --git a/lib/services/connection/call_manager/subscription_manager.dart b/lib/services/connection/call_manager/subscription_manager.dart index 913b8f9214..8e954114b6 100644 --- a/lib/services/connection/call_manager/subscription_manager.dart +++ b/lib/services/connection/call_manager/subscription_manager.dart @@ -51,11 +51,11 @@ class SubscriptionManager extends BaseCallManager> { } @override - Stream call({ - required Request request, - int cacheSize = 0, - RequestCompareFunction? comparePredicate, - }) { + Stream call( + {required Request request, + int cacheSize = 0, + RequestCompareFunction? comparePredicate, + bool acceptNullValue = false}) { assert(cacheSize >= 0); final PendingRequest? pendingRequest = _getPendingRequest( @@ -78,6 +78,7 @@ class SubscriptionManager extends BaseCallManager> { addToChannel( request: request, subscriptionStream: subscriptionStream, + acceptNullValue: acceptNullValue, ); return subscriptionStream.stream; diff --git a/test/services/call_manager/base_call_manager_test.dart b/test/services/call_manager/base_call_manager_test.dart index 5ba12de77b..afd176a357 100644 --- a/test/services/call_manager/base_call_manager_test.dart +++ b/test/services/call_manager/base_call_manager_test.dart @@ -50,7 +50,7 @@ class MockCallManager extends BaseCallManager { MockCallManager(BaseAPI api) : super(api); @override - MockResponse call({required Request request}) { + MockResponse call({required Request request, bool acceptNullValue = false}) { throw UnimplementedError(); } } @@ -60,7 +60,8 @@ class MockAPI implements BaseAPI { void addToChannel(Map request) {} @override - Future call({required Request request}) => throw UnimplementedError(); + Future call({required Request request, bool acceptNullValue = false}) => + throw UnimplementedError(); @override Future connect( From cd67b3bdcac01f457d939c0f0a7a86affa287d1b Mon Sep 17 00:00:00 2001 From: Reza <94842463+Reza-deriv@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:29:36 +0800 Subject: [PATCH 3/7] change logic to accept null value --- .../connection/call_manager/base_call_manager.dart | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/services/connection/call_manager/base_call_manager.dart b/lib/services/connection/call_manager/base_call_manager.dart index 64e5091ba2..e8ee58bcd0 100644 --- a/lib/services/connection/call_manager/base_call_manager.dart +++ b/lib/services/connection/call_manager/base_call_manager.dart @@ -108,8 +108,13 @@ abstract class BaseCallManager { required bool isSubscription, bool acceptNullValue = false, }) { - final Map result = request.toJson() - ..removeWhere((String key, dynamic value) => value == null); + final Map result; + if (acceptNullValue) { + result = request.toJson(); + } else { + result = request.toJson() + ..removeWhere((String key, dynamic value) => value == null); + } if (isSubscription) { result.putIfAbsent('subscribe', () => 1); From 22d32fc4587dfe9619027501ae264cfb31871db2 Mon Sep 17 00:00:00 2001 From: Reza <94842463+Reza-deriv@users.noreply.github.com> Date: Thu, 21 Mar 2024 17:41:49 +0800 Subject: [PATCH 4/7] add comment --- lib/services/connection/call_manager/base_call_manager.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/services/connection/call_manager/base_call_manager.dart b/lib/services/connection/call_manager/base_call_manager.dart index e8ee58bcd0..ae2d3e1485 100644 --- a/lib/services/connection/call_manager/base_call_manager.dart +++ b/lib/services/connection/call_manager/base_call_manager.dart @@ -109,6 +109,7 @@ abstract class BaseCallManager { bool acceptNullValue = false, }) { final Map result; + // check if acceptNullValue is true or not. if (acceptNullValue) { result = request.toJson(); } else { From 80d22dfb4030580bbdc2c14bc49d60db34ef6f69 Mon Sep 17 00:00:00 2001 From: Reza <94842463+Reza-deriv@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:02:13 +0800 Subject: [PATCH 5/7] fix issue --- lib/services/connection/api_manager/binary_api.dart | 1 + 1 file changed, 1 insertion(+) diff --git a/lib/services/connection/api_manager/binary_api.dart b/lib/services/connection/api_manager/binary_api.dart index 55641c2c43..26600b8f35 100644 --- a/lib/services/connection/api_manager/binary_api.dart +++ b/lib/services/connection/api_manager/binary_api.dart @@ -143,6 +143,7 @@ class BinaryAPI extends BaseAPI { {required Request request, bool acceptNullValue = false}) async { final Response response = await (_callManager ??= CallManager(this))( request: request, + acceptNullValue: acceptNullValue, ); if (response is T) { From 375a61c7bec0b669c78adc7a2658285c2cf1319e Mon Sep 17 00:00:00 2001 From: Reza <94842463+Reza-deriv@users.noreply.github.com> Date: Thu, 21 Mar 2024 18:30:30 +0800 Subject: [PATCH 6/7] add nullableKey for allowing null field in request --- .../connection/api_manager/base_api.dart | 5 ++++- .../connection/api_manager/binary_api.dart | 4 ++-- .../connection/api_manager/mock_api.dart | 5 ++++- .../call_manager/base_call_manager.dart | 22 +++++++++---------- .../connection/call_manager/call_manager.dart | 8 ++++--- .../call_manager/subscription_manager.dart | 13 ++++++----- .../call_manager/base_call_manager_test.dart | 10 +++++++-- 7 files changed, 40 insertions(+), 27 deletions(-) diff --git a/lib/services/connection/api_manager/base_api.dart b/lib/services/connection/api_manager/base_api.dart index 5588a0c9d1..3d077063b3 100644 --- a/lib/services/connection/api_manager/base_api.dart +++ b/lib/services/connection/api_manager/base_api.dart @@ -33,7 +33,10 @@ abstract class BaseAPI { void addToChannel(Map request); /// Calls a API method by [request]. - Future call({required Request request, bool acceptNullValue = false}); + Future call({ + required Request request, + List nullableKey = const [], + }); /// Subscribe to a [request]. /// [comparePredicate] indicates compare condition for current [request] and [pendingRequest]s diff --git a/lib/services/connection/api_manager/binary_api.dart b/lib/services/connection/api_manager/binary_api.dart index 26600b8f35..01ca3a9f7b 100644 --- a/lib/services/connection/api_manager/binary_api.dart +++ b/lib/services/connection/api_manager/binary_api.dart @@ -140,10 +140,10 @@ class BinaryAPI extends BaseAPI { @override Future call( - {required Request request, bool acceptNullValue = false}) async { + {required Request request, List nullableKey = const [],}) async { final Response response = await (_callManager ??= CallManager(this))( request: request, - acceptNullValue: acceptNullValue, + nullableKey: nullableKey, ); if (response is T) { diff --git a/lib/services/connection/api_manager/mock_api.dart b/lib/services/connection/api_manager/mock_api.dart index 7dc05ad931..a48ba96e2d 100644 --- a/lib/services/connection/api_manager/mock_api.dart +++ b/lib/services/connection/api_manager/mock_api.dart @@ -130,7 +130,10 @@ class MockAPI extends BaseAPI { void addToChannel(Map request) {} @override - Future call({required Request request, bool acceptNullValue = false}) => + Future call({ + required Request request, + List nullableKey = const [], + }) => _getFutureResponse(request); @override diff --git a/lib/services/connection/call_manager/base_call_manager.dart b/lib/services/connection/call_manager/base_call_manager.dart index ae2d3e1485..6594f7f8e8 100644 --- a/lib/services/connection/call_manager/base_call_manager.dart +++ b/lib/services/connection/call_manager/base_call_manager.dart @@ -43,7 +43,10 @@ abstract class BaseCallManager { bool contains(int? requestId) => _pendingRequests.containsKey(requestId); /// Calls a API method by [request] - T call({required Request request, bool acceptNullValue = false}); + T call({ + required Request request, + List nullableKey = const [], + }); /// Handle call [response] that comes from server void handleResponse({ @@ -62,14 +65,14 @@ abstract class BaseCallManager { Future addToChannel({ required Request request, SubscriptionStream? subscriptionStream, - bool acceptNullValue = false, + List nullableKey = const [], }) { final Completer responseCompleter = Completer(); final Request requestWithId = request.copyWith(reqId: _getRequestId()); final Map prepareRequest = _prepareRequest( request: requestWithId, isSubscription: subscriptionStream != null, - acceptNullValue: acceptNullValue, + nullableKey: nullableKey, ); _addPendingRequest( @@ -106,16 +109,11 @@ abstract class BaseCallManager { Map _prepareRequest({ required Request request, required bool isSubscription, - bool acceptNullValue = false, + List nullableKey = const [], }) { - final Map result; - // check if acceptNullValue is true or not. - if (acceptNullValue) { - result = request.toJson(); - } else { - result = request.toJson() - ..removeWhere((String key, dynamic value) => value == null); - } + final Map result = request.toJson() + ..removeWhere((String key, dynamic value) => + value == null && !(nullableKey.contains(key))); if (isSubscription) { result.putIfAbsent('subscribe', () => 1); diff --git a/lib/services/connection/call_manager/call_manager.dart b/lib/services/connection/call_manager/call_manager.dart index a225c4057c..125ce46735 100644 --- a/lib/services/connection/call_manager/call_manager.dart +++ b/lib/services/connection/call_manager/call_manager.dart @@ -29,7 +29,9 @@ class CallManager extends BaseCallManager> { } @override - Future call( - {required Request request, bool acceptNullValue = false}) async => - addToChannel(request: request, acceptNullValue: acceptNullValue); + Future call({ + required Request request, + List nullableKey = const [], + }) async => + addToChannel(request: request, nullableKey: nullableKey); } diff --git a/lib/services/connection/call_manager/subscription_manager.dart b/lib/services/connection/call_manager/subscription_manager.dart index 8e954114b6..fc9a0d8a4d 100644 --- a/lib/services/connection/call_manager/subscription_manager.dart +++ b/lib/services/connection/call_manager/subscription_manager.dart @@ -51,11 +51,12 @@ class SubscriptionManager extends BaseCallManager> { } @override - Stream call( - {required Request request, - int cacheSize = 0, - RequestCompareFunction? comparePredicate, - bool acceptNullValue = false}) { + Stream call({ + required Request request, + int cacheSize = 0, + RequestCompareFunction? comparePredicate, + List nullableKey = const [], + }) { assert(cacheSize >= 0); final PendingRequest? pendingRequest = _getPendingRequest( @@ -78,7 +79,7 @@ class SubscriptionManager extends BaseCallManager> { addToChannel( request: request, subscriptionStream: subscriptionStream, - acceptNullValue: acceptNullValue, + nullableKey: nullableKey, ); return subscriptionStream.stream; diff --git a/test/services/call_manager/base_call_manager_test.dart b/test/services/call_manager/base_call_manager_test.dart index afd176a357..09433bd9c0 100644 --- a/test/services/call_manager/base_call_manager_test.dart +++ b/test/services/call_manager/base_call_manager_test.dart @@ -50,7 +50,10 @@ class MockCallManager extends BaseCallManager { MockCallManager(BaseAPI api) : super(api); @override - MockResponse call({required Request request, bool acceptNullValue = false}) { + MockResponse call({ + required Request request, + List nullableKey = const [], + }) { throw UnimplementedError(); } } @@ -60,7 +63,10 @@ class MockAPI implements BaseAPI { void addToChannel(Map request) {} @override - Future call({required Request request, bool acceptNullValue = false}) => + Future call({ + required Request request, + List nullableKey = const [], + }) => throw UnimplementedError(); @override From 44355e8de3a44fbe2abddb820249d229594c39a2 Mon Sep 17 00:00:00 2001 From: Reza <94842463+Reza-deriv@users.noreply.github.com> Date: Fri, 22 Mar 2024 14:59:08 +0800 Subject: [PATCH 7/7] change nullableKeys name --- lib/services/connection/api_manager/base_api.dart | 2 +- lib/services/connection/api_manager/binary_api.dart | 4 ++-- lib/services/connection/api_manager/mock_api.dart | 2 +- .../connection/call_manager/base_call_manager.dart | 10 +++++----- lib/services/connection/call_manager/call_manager.dart | 4 ++-- .../connection/call_manager/subscription_manager.dart | 4 ++-- test/services/call_manager/base_call_manager_test.dart | 4 ++-- 7 files changed, 15 insertions(+), 15 deletions(-) diff --git a/lib/services/connection/api_manager/base_api.dart b/lib/services/connection/api_manager/base_api.dart index 3d077063b3..e20df3928a 100644 --- a/lib/services/connection/api_manager/base_api.dart +++ b/lib/services/connection/api_manager/base_api.dart @@ -35,7 +35,7 @@ abstract class BaseAPI { /// Calls a API method by [request]. Future call({ required Request request, - List nullableKey = const [], + List nullableKeys = const [], }); /// Subscribe to a [request]. diff --git a/lib/services/connection/api_manager/binary_api.dart b/lib/services/connection/api_manager/binary_api.dart index 01ca3a9f7b..b3203760f2 100644 --- a/lib/services/connection/api_manager/binary_api.dart +++ b/lib/services/connection/api_manager/binary_api.dart @@ -140,10 +140,10 @@ class BinaryAPI extends BaseAPI { @override Future call( - {required Request request, List nullableKey = const [],}) async { + {required Request request, List nullableKeys = const [],}) async { final Response response = await (_callManager ??= CallManager(this))( request: request, - nullableKey: nullableKey, + nullableKeys: nullableKeys, ); if (response is T) { diff --git a/lib/services/connection/api_manager/mock_api.dart b/lib/services/connection/api_manager/mock_api.dart index a48ba96e2d..a2b0ea308f 100644 --- a/lib/services/connection/api_manager/mock_api.dart +++ b/lib/services/connection/api_manager/mock_api.dart @@ -132,7 +132,7 @@ class MockAPI extends BaseAPI { @override Future call({ required Request request, - List nullableKey = const [], + List nullableKeys = const [], }) => _getFutureResponse(request); diff --git a/lib/services/connection/call_manager/base_call_manager.dart b/lib/services/connection/call_manager/base_call_manager.dart index 6594f7f8e8..2e5dfb04ea 100644 --- a/lib/services/connection/call_manager/base_call_manager.dart +++ b/lib/services/connection/call_manager/base_call_manager.dart @@ -45,7 +45,7 @@ abstract class BaseCallManager { /// Calls a API method by [request] T call({ required Request request, - List nullableKey = const [], + List nullableKeys = const [], }); /// Handle call [response] that comes from server @@ -65,14 +65,14 @@ abstract class BaseCallManager { Future addToChannel({ required Request request, SubscriptionStream? subscriptionStream, - List nullableKey = const [], + List nullableKeys = const [], }) { final Completer responseCompleter = Completer(); final Request requestWithId = request.copyWith(reqId: _getRequestId()); final Map prepareRequest = _prepareRequest( request: requestWithId, isSubscription: subscriptionStream != null, - nullableKey: nullableKey, + nullableKeys: nullableKeys, ); _addPendingRequest( @@ -109,11 +109,11 @@ abstract class BaseCallManager { Map _prepareRequest({ required Request request, required bool isSubscription, - List nullableKey = const [], + List nullableKeys = const [], }) { final Map result = request.toJson() ..removeWhere((String key, dynamic value) => - value == null && !(nullableKey.contains(key))); + value == null && !(nullableKeys.contains(key))); if (isSubscription) { result.putIfAbsent('subscribe', () => 1); diff --git a/lib/services/connection/call_manager/call_manager.dart b/lib/services/connection/call_manager/call_manager.dart index 125ce46735..d2f72044e1 100644 --- a/lib/services/connection/call_manager/call_manager.dart +++ b/lib/services/connection/call_manager/call_manager.dart @@ -31,7 +31,7 @@ class CallManager extends BaseCallManager> { @override Future call({ required Request request, - List nullableKey = const [], + List nullableKeys = const [], }) async => - addToChannel(request: request, nullableKey: nullableKey); + addToChannel(request: request, nullableKeys: nullableKeys); } diff --git a/lib/services/connection/call_manager/subscription_manager.dart b/lib/services/connection/call_manager/subscription_manager.dart index fc9a0d8a4d..040630ae9d 100644 --- a/lib/services/connection/call_manager/subscription_manager.dart +++ b/lib/services/connection/call_manager/subscription_manager.dart @@ -55,7 +55,7 @@ class SubscriptionManager extends BaseCallManager> { required Request request, int cacheSize = 0, RequestCompareFunction? comparePredicate, - List nullableKey = const [], + List nullableKeys = const [], }) { assert(cacheSize >= 0); @@ -79,7 +79,7 @@ class SubscriptionManager extends BaseCallManager> { addToChannel( request: request, subscriptionStream: subscriptionStream, - nullableKey: nullableKey, + nullableKeys: nullableKeys, ); return subscriptionStream.stream; diff --git a/test/services/call_manager/base_call_manager_test.dart b/test/services/call_manager/base_call_manager_test.dart index 09433bd9c0..b8c2935823 100644 --- a/test/services/call_manager/base_call_manager_test.dart +++ b/test/services/call_manager/base_call_manager_test.dart @@ -52,7 +52,7 @@ class MockCallManager extends BaseCallManager { @override MockResponse call({ required Request request, - List nullableKey = const [], + List nullableKeys = const [], }) { throw UnimplementedError(); } @@ -65,7 +65,7 @@ class MockAPI implements BaseAPI { @override Future call({ required Request request, - List nullableKey = const [], + List nullableKeys = const [], }) => throw UnimplementedError();