skip to Main Content

Flutter – List with 0 items after fetch

import 'dart:convert'; import 'package:http/http.dart' as http; import 'package:trilhaapp/model/post_model.dart'; class PostsRepository { Future<List<PostModel>> fetchPosts() async { var response = await http.get(Uri.parse('https://jsonplaceholder.typicode.com/posts')); if (response.statusCode == 200) { var postList = jsonDecode(response.body); return (postList as List).map((e) => PostModel.fromJson(e)).toList(); } else { throw Exception('Failed…

VIEW QUESTION

this.theme = theme ?? DatePickerTheme() – How do I resolve this error in flutter?

Launching libmain.dart on sdk gphone64 x86 64 in debug mode... : Error: 'DatePickerTheme' is imported from both 'package:flutter/src/material/date_picker_theme.dart' and 'package:flutter_datetime_picker/src/datetime_picker_theme.dart'. import 'package:flutter_datetime_picker/src/datetime_picker_theme.dart'; ^^^^^^^^^^^^^^^ : Error: 'DatePickerTheme' is imported from both 'package:flutter/src/material/date_picker_theme.dart' and 'package:flutter_datetime_picker/src/datetime_picker_theme.dart'. this.theme = theme ?? DatePickerTheme(), ^^^^^^^^^^^^^^^ Target…

VIEW QUESTION
Back To Top
Search