diff --git a/lib/src/network/parse_http_client.dart b/lib/src/network/parse_http_client.dart index c5f8749ca..b577f4849 100644 --- a/lib/src/network/parse_http_client.dart +++ b/lib/src/network/parse_http_client.dart @@ -17,8 +17,9 @@ class ParseHTTPClient extends BaseClient { /// Overrides the call method for HTTP Client and adds custom headers @override Future send(BaseRequest request) { - if (!identical(0, 0.0)) + if (!identical(0, 0.0)) { request.headers[keyHeaderUserAgent] = _userAgent; + } request.headers[keyHeaderApplicationId] = data.applicationId; if ((_sendSessionId == true) && (data.sessionId != null) && diff --git a/lib/src/network/parse_live_query.dart b/lib/src/network/parse_live_query.dart index ce1dc3f4b..0c33147d6 100644 --- a/lib/src/network/parse_live_query.dart +++ b/lib/src/network/parse_live_query.dart @@ -193,4 +193,4 @@ class LiveQuery { await _webSocket.close(); } } -} \ No newline at end of file +} diff --git a/lib/src/network/parse_live_query_web.dart b/lib/src/network/parse_live_query_web.dart index 807fb07a3..59a9ce6df 100644 --- a/lib/src/network/parse_live_query_web.dart +++ b/lib/src/network/parse_live_query_web.dart @@ -1,10 +1,17 @@ import 'dart:convert'; // ignore: uri_does_not_exist -import 'dart:html' as HTML; +import 'dart:html' as html; import '../../parse_server_sdk.dart'; -enum LiveQueryEvent { create, enter, update, leave, delete, error } +enum LiveQueryEvent { + create, + enter, + update, + leave, + delete, + error +} class LiveQuery { LiveQuery({bool debug, ParseHTTPClient client, bool autoSendSessionId}) { @@ -19,7 +26,7 @@ class LiveQuery { autoSendSessionId ?? ParseCoreData().autoSendSessionId ?? true; } - HTML.WebSocket _webSocket; + html.WebSocket _webSocket; ParseHTTPClient _client; bool _debug; bool _sendSessionId; @@ -65,10 +72,10 @@ class LiveQuery { final int requestId = _requestIdGenerator(); try { - _webSocket = HTML.WebSocket(_liveQueryURL); + _webSocket = html.WebSocket(_liveQueryURL); await _webSocket.onOpen.first; - if (_webSocket != null && _webSocket.readyState == HTML.WebSocket.OPEN) { + if (_webSocket != null && _webSocket.readyState == html.WebSocket.OPEN) { if (_debug) { print('$_printConstLiveQuery: Socket opened'); } @@ -79,7 +86,7 @@ class LiveQuery { } } - _webSocket.onMessage.listen((HTML.MessageEvent e) { + _webSocket.onMessage.listen((html.MessageEvent e) { final dynamic message = e.data; if (_debug) { print('$_printConstLiveQuery: Listen: $message'); @@ -170,7 +177,7 @@ class LiveQuery { } Future unSubscribe() async { - if (_webSocket != null && _webSocket.readyState == HTML.WebSocket.OPEN) { + if (_webSocket != null && _webSocket.readyState == html.WebSocket.OPEN) { _webSocket.sendString(jsonEncode(_unsubscribeMessage)); if (_debug) { print('$_printConstLiveQuery: Socket closed'); diff --git a/lib/src/objects/parse_file.dart b/lib/src/objects/parse_file.dart index 7700ec552..437db692c 100644 --- a/lib/src/objects/parse_file.dart +++ b/lib/src/objects/parse_file.dart @@ -37,7 +37,6 @@ class ParseFile extends ParseBase { String get url => super.get(keyVarURL); set url(String url) => set(keyVarURL, url); - @override String _path; bool get saved => url != null; @@ -85,7 +84,6 @@ class ParseFile extends ParseBase { } /// Uploads a file to Parse Server - @override Future save() async { return upload(); } diff --git a/lib/src/objects/parse_relation.dart b/lib/src/objects/parse_relation.dart index 307e244ca..638976407 100644 --- a/lib/src/objects/parse_relation.dart +++ b/lib/src/objects/parse_relation.dart @@ -15,7 +15,7 @@ class ParseRelation { QueryBuilder getQuery() { return QueryBuilder(ParseObject(_targetClass)); } - + void add(T object) { if (object != null) { _targetClass = object.parseClassName; @@ -33,9 +33,13 @@ class ParseRelation { } Map toJson() => - {'__type': keyRelation, 'className': _objects?.first?.parseClassName, 'objects': parseEncode(_objects?.toList())}; + { + '__type': keyRelation, + 'className': _objects?.first?.parseClassName, + 'objects': parseEncode(_objects?.toList()) + }; ParseRelation fromJson(Map map) => ParseRelation() - .._objects = parseDecode(map['objects']) - .._targetClass = map['className']; -} \ No newline at end of file + .._objects = parseDecode(map['objects']) + .._targetClass = map['className']; +} diff --git a/lib/src/objects/parse_user.dart b/lib/src/objects/parse_user.dart index 6e3db60f0..6e234a71e 100644 --- a/lib/src/objects/parse_user.dart +++ b/lib/src/objects/parse_user.dart @@ -106,9 +106,8 @@ class ParseUser extends ParseObject implements ParseCloneable { try { final Uri url = getSanitisedUri(_client, '$keyEndPointUserName'); final Response response = await _client.get(url, headers: headers); - return await _handleResponse( - _getEmptyUser(), response, ParseApiRQ.currentUser, - _debug, _getEmptyUser().parseClassName); + return await _handleResponse(_getEmptyUser(), response, + ParseApiRQ.currentUser, _debug, _getEmptyUser().parseClassName); } on Exception catch (e) { return handleException( e, ParseApiRQ.currentUser, _debug, _getEmptyUser().parseClassName); @@ -277,9 +276,8 @@ class ParseUser extends ParseObject implements ParseCloneable { final Response response = await _client.post( '${_client.data.serverUrl}$keyEndPointRequestPasswordReset', body: json.encode({keyVarEmail: emailAddress})); - return await _handleResponse( - this, response, ParseApiRQ.requestPasswordReset, _debug, - parseClassName); + return await _handleResponse(this, response, + ParseApiRQ.requestPasswordReset, _debug, parseClassName); } on Exception catch (e) { return handleException( e, ParseApiRQ.requestPasswordReset, _debug, parseClassName); @@ -364,8 +362,7 @@ class ParseUser extends ParseObject implements ParseCloneable { /// Handles all the response data for this class static Future _handleResponse(ParseUser user, - Response response, - ParseApiRQ type, bool debug, String className) async { + Response response, ParseApiRQ type, bool debug, String className) async { final ParseResponse parseResponse = handleResponse(user, response, type, debug, className); diff --git a/lib/src/objects/response/parse_response_utils.dart b/lib/src/objects/response/parse_response_utils.dart index 6b6f71310..0201ee539 100644 --- a/lib/src/objects/response/parse_response_utils.dart +++ b/lib/src/objects/response/parse_response_utils.dart @@ -58,7 +58,6 @@ bool isSuccessButNoResults(Response apiResponse) { results = decodedResponse; } - if (results == null) { return false; } diff --git a/lib/src/storage/core_store_sem_impl.dart b/lib/src/storage/core_store_sem_impl.dart index 3e0116407..bb5d4ecf4 100644 --- a/lib/src/storage/core_store_sem_impl.dart +++ b/lib/src/storage/core_store_sem_impl.dart @@ -1,5 +1,6 @@ part of flutter_parse_sdk; +// ignore_for_file: deprecated_member_use class CoreStoreSembastImp implements CoreStore { CoreStoreSembastImp._internal(this._store); diff --git a/lib/src/utils/parse_utils.dart b/lib/src/utils/parse_utils.dart index 8347bfedf..0180f0021 100644 --- a/lib/src/utils/parse_utils.dart +++ b/lib/src/utils/parse_utils.dart @@ -66,7 +66,8 @@ String removeTrailingSlash(String serverUrl) { } Future batchRequest(List requests, - List objects, {ParseHTTPClient client, bool debug}) async { + List objects, + {ParseHTTPClient client, bool debug}) async { debug = isDebugEnabled(objectLevelDebug: debug); client = client ?? ParseHTTPClient( diff --git a/pubspec.yaml b/pubspec.yaml index bd04e3490..386b12528 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -8,15 +8,15 @@ environment: sdk: ">=2.2.2 <3.0.0" dependencies: + http: ^0.12.0+2 flutter: sdk: flutter # Networking web_socket_channel: ^1.0.13 - http: ^0.12.0+2 #Database - sembast: ^1.17.0 + sembast: ^2.0.1 xxtea: ^2.0.2 shared_preferences: ^0.5.3+2