getDeviceList static method

Future<List<EzvizDeviceInfo>> getDeviceList({
  1. int pageStart = 0,
  2. int pageSize = 10,
})

Get device list from account

Parameters:

  • pageStart: Start page index (default: 0)
  • pageSize: Page size (default: 10, max: 50)

Returns list of EzvizDeviceInfo objects

Implementation

static Future<List<EzvizDeviceInfo>> getDeviceList({
  int pageStart = 0,
  int pageSize = 10,
}) async {
  try {
    final List<dynamic> result = await _channel.invokeMethod(
      EzvizChannelMethods.getDeviceList,
      {
        'pageStart': pageStart,
        'pageSize': pageSize,
      },
    );

    return result.map<EzvizDeviceInfo>((deviceData) {
      final map = Map<String, dynamic>.from(deviceData as Map);
      return EzvizDeviceInfo.fromJson(map);
    }).toList();
  } catch (e) {
    ezvizLog('Error getting device list: $e');
    return [];
  }
}