I have an error when I tried to run de future: DB_helper().fetchData(),

    Future<List<Scale>>fetchData() async {
    final Database db = await _initDatabase();
    final List<Map<String, dynamic>> queryResult = await db.query(table);
    //inspect(queryResult);
    return queryResult.map((e) => Scale).toList(); //error
  }


Solution 1: Suz Zan

In here

return queryResult.map((e) => Scale).toList(); 

You are returning the type Scale instead of the Scale data.

it should be something like this

return queryResult.map((e) => Scale.fromMap(e)).toList(); 

Your Scale Model class should look like this

class Scale {
  int id;
  String codigo;
  String ubicacion;
  String capacidad;
  String resolucion;
  String unidades;
  String marca;
  String modelo;
  String serie;
  Scale({
    required this.id,
    required this.codigo,
    required this.ubicacion,
    required this.capacidad,
    required this.resolucion,
    required this.unidades,
    required this.marca,
    required this.modelo,
    required this.serie,
  });

  Map<String, dynamic> toMap() {
    return <String, dynamic>{
      'id': id,
      'codigo': codigo,
      'ubicacion': ubicacion,
      'capacidad': capacidad,
      'resolucion': resolucion,
      'unidades': unidades,
      'marca': marca,
      'modelo': modelo,
      'serie': serie,
    };
  }

  factory Scale.fromMap(Map<String, dynamic> map) {
    return Scale(
      id: map['id'] as int,
      codigo: map['codigo'] as String,
      ubicacion: map['ubicacion'] as String,
      capacidad: map['capacidad'] as String,
      resolucion: map['resolucion'] as String,
      unidades: map['unidades'] as String,
      marca: map['marca'] as String,
      modelo: map['modelo'] as String,
      serie: map['serie'] as String,
    );
  }

  String toJson() => json.encode(toMap());

  factory Scale.fromJson(String source) => Scale.fromMap(json.decode(source) as Map<String, dynamic>);

}