socketexception os ошибка соединения отказано errno = 111 адрес = localhost порт = 44297 - PullRequest
0 голосов
/ 11 ноября 2019
class ApiUtl {
    static const String MAIN_API_URL = 'http://localhost/laravel/generalshop/public/api/';
    static const String AUTH_REGISTER = MAIN_API_URL + 'auth/register';
    static const String AUTH_LOGIN = MAIN_API_URL +'auth/login';
}

Future<List<ProductCategory>> fetchCategories() async {
    await checkInternet();
    String url = ApiUtl.CATEGORIES
    print("enter");
    http.Response response = await http.get(url, headers: headers);
    switch (response.statusCode) {
        case 200:
            print(response.statusCode);
            List<ProductCategory> categories = [];
            var body = jsonDecode(response.body);
            for (var item in body['data']) {
                categories.add(ProductCategory.fromJson(item));
            }
            print(categories);
Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...