getAvailableProfiles static method

Future<List> getAvailableProfiles()

Implementation

static Future<List<dynamic>> getAvailableProfiles() async {
  final content =
      await Resource('package:esc_pos_dart/resources/capabilities.json')
          .readAsString();
  Map capabilities = json.decode(content);

  var profiles = capabilities['profiles'];

  List<dynamic> res = [];

  profiles.forEach((k, v) {
    res.add({
      'key': k,
      'vendor': v['vendor'] is String ? v['vendor'] : '',
      'model': v['model'] is String ? v['model'] : '',
      'description': v['description'] is String ? v['description'] : '',
    });
  });

  return res;
}