I have the following Getter and Setter:
class Categoria {
String categoria;
String getCategoria() {
return categoria;
}
void setCategoria(String categoria) {
this.categoria = categoria;
}
When generating the String of the Setter it goes perfectly:
import 'package:vivi_carhue/entidades/direcciones.dart' as dire;
onTap: () {
dire.Categoria().setCategoria("supermercado");
//String cate = "supermercado";
//dire.categoria(cate);
Navigator.push(
context,
MaterialPageRoute(builder: (context) => pantalla_lista(),
),
);
I have the problem in the Getter, since I get an error:
final response =
await http.get( dire.direcciones.ip.toString() + dire.Categoria.getCategoria().toString() );
"Instance member 'getCategory' can't be accessed using static access"
You're accessing the method
getCategoria()
assuming that method isstatic
, but it isn't, you have 2 options:1- declare your static method
2- Use the Category instance instead of the class
So: