diff --git a/lib/src/service/user_service.dart b/lib/src/service/user_service.dart index 24d872d..2cfe1a2 100644 --- a/lib/src/service/user_service.dart +++ b/lib/src/service/user_service.dart @@ -2,9 +2,9 @@ import 'dart:convert'; import 'package:dio/dio.dart'; -import '../thingsboard_client_base.dart'; import '../http/http_utils.dart'; import '../model/model.dart'; +import '../thingsboard_client_base.dart'; PageData parseUserPageData(Map json) { return PageData.fromJson(json, (json) => User.fromJson(json)); @@ -228,11 +228,12 @@ class UserService { Future getMobileSession(String mobileToken, {RequestConfig? requestConfig}) async { - var options = defaultHttpOptionsFromConfig(requestConfig); + final options = defaultHttpOptionsFromConfig(requestConfig); options.headers?[MOBILE_TOKEN_HEADER] = mobileToken; - var response = await _tbClient.get>( - '/api/user/mobile/session', - options: options); + final response = await _tbClient.get( + '/api/user/mobile/session', + options: options, + ); return response.data != null ? MobileSessionInfo.fromJson(response.data!) : null; @@ -241,16 +242,22 @@ class UserService { Future saveMobileSession( String mobileToken, MobileSessionInfo sessionInfo, {RequestConfig? requestConfig}) async { - var options = defaultHttpOptionsFromConfig(requestConfig); + final options = defaultHttpOptionsFromConfig(requestConfig); options.headers?[MOBILE_TOKEN_HEADER] = mobileToken; - await _tbClient.post('/api/user/mobile/session', - data: jsonEncode(sessionInfo), options: options); + await _tbClient.post( + '/api/user/mobile/session', + data: jsonEncode(sessionInfo), + options: options, + ); } Future removeMobileSession(String mobileToken, {RequestConfig? requestConfig}) async { - var options = defaultHttpOptionsFromConfig(requestConfig); + final options = defaultHttpOptionsFromConfig(requestConfig); options.headers?[MOBILE_TOKEN_HEADER] = mobileToken; - await _tbClient.delete('/api/user/mobile/session', options: options); + await _tbClient.delete( + '/api/user/mobile/session', + options: options, + ); } }