Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

throw m issue #2351

Closed
bkparmar007 opened this issue Jan 8, 2025 · 0 comments
Closed

throw m issue #2351

bkparmar007 opened this issue Jan 8, 2025 · 0 comments

Comments

@bkparmar007
Copy link

Request Statement

import 'package:flutter/material.dart';
import 'package:untitled/api_service/api_service.dart';
import 'package:untitled/model/user_model.dart';

class UserProvider extends ChangeNotifier {
final ApiService apiService = ApiService();

List post = [];
bool isLoading = false;
String error = "";

Future fetchpost() async {
isLoading = true;
notifyListeners();
try {
post = await apiService.fetchdata();
isLoading = false;
notifyListeners();
} catch (e) {
isLoading = true;
error = e.toString();
notifyListeners();
}
}
}
// Future<List> fetchdata() async {
// try {
// final response = await _dio.get(url);
// if (response.statusCode == 200) {
// List post =
// (response.data as List).map((e) => UserModel.fromJson(e)).toList();
// return post;
// } else {
// throw Exception('failed');
// }
// } catch (e) {
// throw e.toString();
// }
// }

Solution Brainstorm

No response

@bkparmar007 bkparmar007 added the s: feature This issue indicates a feature request label Jan 8, 2025
@AlexV525 AlexV525 closed this as not planned Won't fix, can't repro, duplicate, stale Jan 8, 2025
@AlexV525 AlexV525 added i: not following issue template and removed s: feature This issue indicates a feature request labels Jan 8, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants