Update thingsboard client library
This commit is contained in:
@@ -256,8 +256,7 @@ class TbContext {
|
||||
log.debug('authUser: ${tbClient.getAuthUser()}');
|
||||
if (tbClient.getAuthUser()!.userId != null) {
|
||||
try {
|
||||
userDetails = await tbClient.getUserService().getUser(
|
||||
tbClient.getAuthUser()!.userId!);
|
||||
userDetails = await tbClient.getUserService().getUser();
|
||||
homeDashboard = await tbClient.getDashboardService().getHomeDashboardInfo();
|
||||
} catch (e) {
|
||||
tbClient.logout();
|
||||
|
||||
@@ -46,7 +46,7 @@ abstract class EntityDetailsPage<T extends BaseData> extends TbPageWidget<Entity
|
||||
@override
|
||||
_EntityDetailsPageState createState() => _EntityDetailsPageState();
|
||||
|
||||
Future<T> fetchEntity(String id);
|
||||
Future<T?> fetchEntity(String id);
|
||||
|
||||
ValueNotifier<String>? detailsTitle() {
|
||||
return null;
|
||||
@@ -58,7 +58,7 @@ abstract class EntityDetailsPage<T extends BaseData> extends TbPageWidget<Entity
|
||||
|
||||
class _EntityDetailsPageState<T extends BaseData> extends TbPageState<EntityDetailsPage<T>, _EntityDetailsPageState<T>> {
|
||||
|
||||
late Future<T> entityFuture;
|
||||
late Future<T?> entityFuture;
|
||||
late ValueNotifier<String> titleValue;
|
||||
|
||||
@override
|
||||
@@ -112,12 +112,16 @@ class _EntityDetailsPageState<T extends BaseData> extends TbPageState<EntityDeta
|
||||
},
|
||||
),
|
||||
),
|
||||
body: FutureBuilder<T>(
|
||||
body: FutureBuilder<T?>(
|
||||
future: entityFuture,
|
||||
builder: (context, snapshot) {
|
||||
if (snapshot.hasData) {
|
||||
var entity = snapshot.data!;
|
||||
if (snapshot.connectionState == ConnectionState.done) {
|
||||
var entity = snapshot.data;
|
||||
if (entity != null) {
|
||||
return widget.buildEntityDetails(context, entity);
|
||||
} else {
|
||||
return Center(child: Text('Requested entity does not exists.'));
|
||||
}
|
||||
} else {
|
||||
return Center(child: TbProgressIndicator(
|
||||
size: 50.0,
|
||||
|
||||
@@ -278,7 +278,7 @@ class _AlarmCardState extends TbContextState<AlarmCard, _AlarmCardState> {
|
||||
alarm.id!.id!);
|
||||
setState(() {
|
||||
loading = false;
|
||||
this.alarm = newAlarm;
|
||||
this.alarm = newAlarm!;
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -294,7 +294,7 @@ class _AlarmCardState extends TbContextState<AlarmCard, _AlarmCardState> {
|
||||
alarm.id!.id!);
|
||||
setState(() {
|
||||
loading = false;
|
||||
this.alarm = newAlarm;
|
||||
this.alarm = newAlarm!;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ class AssetDetailsPage extends EntityDetailsPage<AssetInfo> {
|
||||
defaultTitle: 'Asset', subTitle: 'Asset details');
|
||||
|
||||
@override
|
||||
Future<AssetInfo> fetchEntity(String assetId) {
|
||||
Future<AssetInfo?> fetchEntity(String assetId) {
|
||||
return tbClient.getAssetService().getAssetInfo(assetId);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,7 +8,7 @@ class CustomerDetailsPage extends ContactBasedDetailsPage<Customer> {
|
||||
super(tbContext, entityId: customerId, defaultTitle: 'Customer', subTitle: 'Customer details');
|
||||
|
||||
@override
|
||||
Future<Customer> fetchEntity(String customerId) {
|
||||
Future<Customer?> fetchEntity(String customerId) {
|
||||
return tbClient.getCustomerService().getCustomer(customerId);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ class DeviceDetailsPage extends EntityDetailsPage<DeviceInfo> {
|
||||
defaultTitle: 'Device');
|
||||
|
||||
@override
|
||||
Future<DeviceInfo> fetchEntity(String deviceId) {
|
||||
Future<DeviceInfo?> fetchEntity(String deviceId) {
|
||||
return tbClient.getDeviceService().getDeviceInfo(deviceId);
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ class _ProfilePageState extends TbPageState<ProfilePage, _ProfilePageState> {
|
||||
|
||||
Future<void> _loadUser() async {
|
||||
_isLoadingNotifier.value = true;
|
||||
_currentUser = await tbClient.getUserService().getUser(tbClient.getAuthUser()!.userId!);
|
||||
_currentUser = await tbClient.getUserService().getUser();
|
||||
_setUser();
|
||||
_isLoadingNotifier.value = false;
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ class TenantDetailsPage extends ContactBasedDetailsPage<Tenant> {
|
||||
super(tbContext, entityId: tenantId, defaultTitle: 'Tenant', subTitle: 'Tenant details');
|
||||
|
||||
@override
|
||||
Future<Tenant> fetchEntity(String tenantId) {
|
||||
Future<Tenant?> fetchEntity(String tenantId) {
|
||||
return tbClient.getTenantService().getTenant(tenantId);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,8 +8,8 @@ abstract class DeviceProfileCache {
|
||||
var deviceProfile = _cache[name];
|
||||
if (deviceProfile == null) {
|
||||
var device = await tbClient.getDeviceService().getDevice(deviceId);
|
||||
deviceProfile = await tbClient.getDeviceProfileService().getDeviceProfileInfo(device.deviceProfileId!.id!);
|
||||
_cache[name] = deviceProfile;
|
||||
deviceProfile = await tbClient.getDeviceProfileService().getDeviceProfileInfo(device!.deviceProfileId!.id!);
|
||||
_cache[name] = deviceProfile!;
|
||||
}
|
||||
return deviceProfile;
|
||||
}
|
||||
|
||||
23
pubspec.lock
23
pubspec.lock
@@ -70,7 +70,7 @@ packages:
|
||||
name: convert
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.0.0"
|
||||
version: "3.0.1"
|
||||
crypto:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -209,14 +209,14 @@ packages:
|
||||
name: geolocator
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "7.1.0"
|
||||
version: "7.1.1"
|
||||
geolocator_platform_interface:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: geolocator_platform_interface
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.1"
|
||||
version: "2.2.0"
|
||||
geolocator_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -251,7 +251,7 @@ packages:
|
||||
name: image_picker
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "0.8.0+3"
|
||||
version: "0.8.1"
|
||||
image_picker_for_web:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -363,7 +363,7 @@ packages:
|
||||
name: pedantic
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "1.11.0"
|
||||
version: "1.11.1"
|
||||
petitparser:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -384,7 +384,7 @@ packages:
|
||||
name: pointycastle
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "3.1.1"
|
||||
version: "3.1.2"
|
||||
qr_code_scanner:
|
||||
dependency: "direct main"
|
||||
description:
|
||||
@@ -458,7 +458,7 @@ packages:
|
||||
description:
|
||||
path: "."
|
||||
ref: HEAD
|
||||
resolved-ref: a899f22d6cd784c72df7abcf42ff190b9d227ee5
|
||||
resolved-ref: "937ab8d40f33f70d6fb4a7a8c96ce974cc08e48d"
|
||||
url: "git@github.com:thingsboard/dart_thingsboard_client.git"
|
||||
source: git
|
||||
version: "1.0.0"
|
||||
@@ -475,7 +475,7 @@ packages:
|
||||
name: url_launcher
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "6.0.6"
|
||||
version: "6.0.7"
|
||||
url_launcher_linux:
|
||||
dependency: transitive
|
||||
description:
|
||||
@@ -518,6 +518,13 @@ packages:
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
web_socket_channel:
|
||||
dependency: transitive
|
||||
description:
|
||||
name: web_socket_channel
|
||||
url: "https://pub.dartlang.org"
|
||||
source: hosted
|
||||
version: "2.1.0"
|
||||
xml:
|
||||
dependency: transitive
|
||||
description:
|
||||
|
||||
Reference in New Issue
Block a user