All Questions
                2,179 questions
            
            
            1
            vote
        
        
            1
            answer
        
        
            46
            views
        
    Disseminate JSON data to freezed data model List<ChildDataModel> through ParentDataModel
                I was trying to disseminate API response to a data model that is specified as List<ChildDataModel> which is nested to a parent data model. Unfortunately, I am confused about why I am ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            43
            views
        
    How to setup Factory Album to map custom REST API json body
                I'm new to Flutter and attempting to use the http package to fetch data from an external REST API. My code below successfully hits the host server (200), but throws an exception 'Failed to load album.'...
            
        
       
    
            2
            votes
        
        
            0
            answers
        
        
            69
            views
        
    Deserialize String from API in FlutterFlow
                I am working with an API which returns me a json that is below, it turns out that this json brings a data that arrives in string format that brings important information for the app.
The problem is ...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            48
            views
        
    Play audio with controls from wordpress to flutter page
                I am trying to play audio from wordpress on my flutter app page using flutter_html and just_audio
I have tried the below but still I can not see any audio controls show up on the page
below my whole ...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            39
            views
        
    Flutter TypeError (type 'List<dynamic>' is not a subtype of type 'Map<String, dynamic>
                I am creating a Flutter app using Flutter News template and when I try to retrieve the feed for a specific category, I keep getting this error: _TypeError (type 'List<dynamic>' is not a subtype ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            69
            views
        
    Json_Annotation does not handle nested classes properly
                I have nested classes InventoryResult and Item that I want to read/write with json files, and the generated code by json_annotation does not map Item list in the toJson() method; curiously handling is ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            105
            views
        
    Flutter Inventory Management: Read from a json assets file, write to a local file and add to a Riverpod managed list of items
                I am trying to learn Flutter through implementation of an inventory app. My app currently reads a list of items from a json file, managed by riverpod, this part works. I also read that Flutter does ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            53
            views
        
    Handling deserialization of a paginated response from Rest API
                I'm designing few Model classes in a Flutter project:
class ModelA { String titleA; /* ... */ }
class ModelB { String titleB; /* ... */ }
As suggested on other pages I've added "fromJson" ...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            34
            views
        
    scssTask Errored during Gulp-Sass execution
                I'm just starting out with Gulp via VS Code but I can't seem to get it working.
Here is my Gulp file:
// Initialize modules
const { src, dest, watch, series } = require('gulp');
const sass = require('...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            80
            views
        
    Flutter App hangs at build: Loading a Json Asset and Using Riverpod
                I will try to be brief and only add relevant pieces of code.
This is the screen that tries to load Item objects from a JSON:
Widget _buildItemList(List<Item> currentItemList) {
return ListView....
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            63
            views
        
    Exception: Error fetching player match history: TypeError: "players": type 'String' is not a subtype of type 'int' (not fetching any int)
                I am trying to run my app but I keep getting this error:
Error: TypeError: "players": type 'String' is not a subtype of type 'int'
Error fetching match history: Exception: Error fetching ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            37
            views
        
    Ignore required fields of a nullable referenced class when parsing JSON in Flutter Dart
                I'm currently trying to display a class that references multiple other classes but are nullable because it's not always sure which one of the referenced classes would have a value. Now, because of ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            51
            views
        
    How to achieve this design in flutter
                So I am trying to redesign what is in the attached image.
(https://i.sstatic.net/65jHd8zB.jpg)
I have tried arranging the items in a stack then using a position widget to position the different ...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            47
            views
        
    How to avoid StackOverflow error during JSON serialization of interconnected objects in Dart?
                I have a Vehicle class in Dart, where each vehicle can be connected to another vehicle using a rope or some other connection. The class has three fields:
previousCar - The vehicle that is in front.
...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            39
            views
        
    How to use fromJson factory from a generic class generated by Freezed?
                I use the Freezed package in my Flutter app to generate REST API models. Everything is okay BUT I can't get how to use a generated fromJson factory for generic classes.
For example, I have a ...
            
        
       
    
            4
            votes
        
        
            1
            answer
        
        
            68
            views
        
    Why dart:convert :: json.encoder turns everything into a string?
                I am trying to send an HTTP PUT request to FastAPI backend from flutter code. I jsonify the data before I put into the request body. Here are my data classes:
class ListeningHistory {
  final String ...
            
        
       
    
            -3
            votes
        
        
            1
            answer
        
        
            49
            views
        
    How to parse json in flutter Dart
                {0: {id: 1, user_id: 1, title: Group A, open: true}, 1: {id: 2, user_id: 1, title: yiuyi, open: false}, pagination: {total: 2, per_page: 10, current_page: 1, last_page: 1, next_page_url: null, ...
            
        
       
    
            -1
            votes
        
        
            0
            answers
        
        
            16
            views
        
    Exception caught by widgets library ═RangeError (index): Invalid value: Valid value range is empty: 0
                i am having this error i tried to use list of cart from api getcartproducts to store in products list then to use in my widgets i don't know what is the issue!
if some one can help me i am not expert ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            49
            views
        
    _TypeError (type 'List<dynamic>' is not a subtype of type 'List<int?>') Flutter
                I'm using the json decoder on a List<List<int?>> json, and I'm having trouble converting the List<dynamic> to the List<List<int?>> I'd like to end up with. Is there a ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            58
            views
        
    Large JSON encode
                I was performing a JSON file encoding in my project and noticed that the method for encoding is synchronous. While discussing this with a friend, he questioned whether a very large JSON file could ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            29
            views
        
    how to migrate to null-safety - Expected a value of type List<ClassroomRoutineModel> , but got one of type List <dynamic>
                I'm trying to migrate an old project to null-safety, and I'm struggling with loading data from assets,
Here is my code :
ClassroomModel _$ClassroomModelFromJson(Map<String, dynamic> json) {
...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            66
            views
        
    How to convert a Map to a List of keys
                Suppose I have the following model (using freezed):
@freezed
class User with _$User {
  const factory User({
    required UserID id,
    required List<String> categories,
  }) = _User;
  ...
            
        
       
    
            0
            votes
        
        
            2
            answers
        
        
            113
            views
        
    FormatException: SyntaxError: Unexpected end of JSON input
                I am getting this error in my flutter app during the api integration phase. I have checked the backend apis through postman they are working fine. But when i integrate it with frontend and then check ...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            90
            views
        
    How to fetch data from nested JSON that have auto number?
                How to fetch data from nested JSON that have auto generated number like this?
{
  "0": {
    "Id": "1",
    "name": "rob"
  },
  "1": {
    &...
            
        
       
    
            1
            vote
        
        
            0
            answers
        
        
            53
            views
        
    ApplicationResourceBundle (.arb) JSON schema wanted
                Context
I'm about to localize my old app and at the moment I'm working on simple Python script to parse my source code for L("blabla") constructions, and extend existing .arb template with ...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            67
            views
        
    Error: TypeError: null: type 'minified:BR' is not a subtype of type 'List<dynamic>'
                I am keep on getting this error code Error: TypeError: null: type 'minified:BR' is not a subtype of type 'List' when I try to upload my json in the firebase to my website in flutter. Here is the code ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            48
            views
        
    How to model a data object that represents a PATCH request body whose fields can be undefined, null or values
                Let's suppose I need to call an HTTP API PATCH endpoint whose schema for the body is:
{
  ...
  "type": "object",
  "properties": {
    "propertyOne": { "...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            112
            views
        
    How to Check if an Object is Serializable at Compile-time or Runtime Using json_serializable in Flutter?
                I have a question regarding the json_serializable package for Flutter.
Is there any way to check at compile-time if an object is serializable using json_serializable?
If not, is there a way to check ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            92
            views
        
    Nested Json Serialization Doesn't Work Event With explicitToJson: TRUE?
                I am new to flutter and have been developing a small api that would pull data from a local mock database I created. The database has a nested Json within it, and no matter what I did, I can't get it ...
            
        
       
    
            0
            votes
        
        
            2
            answers
        
        
            96
            views
        
    How can I get list data in API JSON
                I want to ask about get the data in rapidapi. Previously I had succeeded in retrieving data from Rapidapi in a form like the image below, I retrieved the data in the default article:
Map data = ...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            100
            views
        
    ERROR:flutter/runtime/dart_vm_initializer.cc(41) Unhandled Exception: type '_Map<String, dynamic>' is not a subtype of type 'String?'
                I got this error while working on a Flutter project where I was trying to get profile description data from a Laravel backend. The backend is working fine but I couldn't figure out the problem, this ...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            54
            views
        
    Unintelligible Error: Never fail FormatException from class _ChunkedJsonParser<T> (convert_patch.dart)
                I'm developing my app in Flutter, and I have a search feature that calls a PHP API which interacts with a server to retrieve rows from a database. When I had a local dump of this database and was ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            132
            views
        
    Intermittent FormatException when fetching data using Dio in Flutter
                I am encountering an intermittent FormatException with the message "Unexpected end of input" when fetching data from an API using the Dio library in a Flutter application. This exception ...
            
        
       
    
            2
            votes
        
        
            1
            answer
        
        
            97
            views
        
    How to save custom "card" to Shared Preferences in dart/flutter?
                I'm trying to save the progress AKA "cards".
https://pub.dev/packages/fsrs
I can not serialize it, because it is not a map I guess.
Therefore the following code doesn't work.
import 'package:...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            47
            views
        
    Handling JSON Object Field in Flutter API Call
                I have code that needs to store data from an API call, which returns a list of exams correctly. However, when I try to save this list of exams using a controller based on the ExamData model, I ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            59
            views
        
    Can't double hold an int value?
                I'm receiving data from an API that provides a weather info, for simplicity i will provide just an attribute of the received data:
final double feels_like;
and in json deserialization:
feels_Like = ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            38
            views
        
    How to grab the second occurrence between quotation marks?
                I want to grab the datetime from the following:
{
    "due": "2024-04-27 17:50:02.852Z",
    "stability": 0,
    "difficulty": 0,
    "elapsedDays": 0,...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            66
            views
        
    How to convert Figma tokens Json file to use in Flutter app as a Theme Data
                I have a four Json files contains style tokens, each file has the same structure but for different brand.
how i can convert those files to dart files to use theme as a different Theme Data depending ...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            52
            views
        
    Dart - Serializing and deserializing custom object into and from JSON
                I'm looking for some help with an issue I've been trying to solve for the past couple of days...
My School object contains a list of LateBus objects. On app launch, the list of school objects is saved ...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            42
            views
        
    How to show a list of lists that contain lists with unknown field names?
                I'm new to using Flutter and have to make a model class for a weirdly structured API that I can't seem to find any solutions for within the documentation or anywhere online.
Here's how the JSON file ...
            
        
       
    
            0
            votes
        
        
            0
            answers
        
        
            85
            views
        
    How to send JSON array filled with data from Flutter to API made with php
                I am currently working on a project and I have come across a problem with sending JSON array to PHP API
Here is the code I wrote for the flutter app:
class AddDeviceFormScreen extends StatelessWidget {...
            
        
       
    
            1
            vote
        
        
            1
            answer
        
        
            169
            views
        
    Json Serializable Does not import required class
                Is this a known limitation with inheritance using  https://pub.dev/packages/json_serializable or am I doing something wrong ? I hope the solution is to not simply include the import manually in the ...
            
        
       
    
            0
            votes
        
        
            2
            answers
        
        
            435
            views
        
    Serialize a map containing an object into JSON using Dart
                I am using the json_serializable package in Dart to convert my objects to JSON so I can then store them in a SQLite database. I am struggling in converting one particular property on my class because ...
            
        
       
    
            0
            votes
        
        
            2
            answers
        
        
            67
            views
        
    Json data is empty or had error parsing flutter/dart
                I'm busy coding a page in my flutter app where I would like it to display a list view from a json file but it keeps giving error [ERROR:flutter/runtime/dart_vm_initializer.cc(41)] Unhandled Exception: ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            55
            views
        
    Modify the element of a json that is inside a list
                I hope you can please help me, In my project I am creating a simple list "List listArticulosAdd = [ ];" where i put this map of a json that im decoding from a request https:
mapArticuleCode =...
            
        
       
    
            2
            votes
        
        
            3
            answers
        
        
            79
            views
        
    How to parse json with a variable as any type cast in flutter dart
                Below is my JSON that i am getting in api response. I want to parse below json in flutter dart using json_serializable.
[
  {
    "id": 1,
    "email": "[email protected]"...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            62
            views
        
    type '_Map<String, dynamic>' is not a subtype of type 'String'
                {id: 67, exercise_name: Exercise 1 (B), exercise_solution: https://odishacollege.in/elements/11th/ch1-B.pdf}, {id: 92, exercise_name: Exercise 14 (A), exercise_solution: https://odishacollege.in/...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            166
            views
        
    jsonDecode does not handle \t in JSON data
                I have some JSON data that has \t in it. The flutter jsonDecode function produces an Exception error "Control character in string..." If I replace the \t with a space, no exceptions.
I have ...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            83
            views
        
    Read json file and parse the data key and value using flutter
                I'm currently trying to read json from azure blob storage which I'm able to do.
Now I want to parse the data and display or print the data in Flutter (dart language).
Below is the code.
    Future<...
            
        
       
    
            0
            votes
        
        
            1
            answer
        
        
            48
            views
        
    How do i add json list containing json strings to a .json file and how do i read from it?
                I have a maps that i would like to add to the .json file as json strings using a for loop. And I want to be able to read from the same .json file and be able to deserialize the returned list and loop ...