1234567891011121314151617181920212223242526272829303132333435 |
- // ignore_for_file: camel_case_types
- import 'package:dio/dio.dart';
- import 'package:flutter/material.dart';
- import '../globals.dart';
- class _getuser extends StatefulWidget {
- const _getuser();
- @override
- State<_getuser> createState() => _getuserState();
- }
- class _getuserState extends State<_getuser> {
- late List jsonList;
- void getuser() async {
-
- try {
- var response = await Dio()
- .get('http://localhost:8080/api/v1/users',
- options: Options(headers: headers));
- if (response.statusCode == 200) {
- setState(() {
- jsonList = response.data['results'] as List;
- });
- }
- } catch (e) {
- print(e);
- }
- }
-
- @override
- dynamic noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
- }
|