Created
April 18, 2023 23:37
-
-
Save SebastianQuis/119d7dc72957032bcef11a365d8d4d6a to your computer and use it in GitHub Desktop.
Flutter: Obtener data un endpoint
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class ClienteProvider extends ChangeNotifier { | |
List<Cliente> listaCliente = []; | |
ClienteProvider() { | |
obtenerCliente(); | |
} | |
Future obtenerCliente() async { | |
final url = Uri.parse( | |
'http://23.88.70.235/__demo_tiendas_json/json_clientes_buscar.php?v_token=v789q&v_db=tiendademo&v_campo=nombre&v_buscar=*'); | |
final response = await http.get(url); | |
final dataResponse = ClientesRespuesta.fromJson(response.body); | |
listaCliente = dataResponse.listaClientes; | |
notifyListeners(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Otro método para obtener data es: