Home > Blockchain >  [Dart]-what datra type is this list
[Dart]-what datra type is this list

Time:02-10

If I'm to create a list as below,

      "quizz_answer": [
            {
              "option_id": 1,
              "is_selected": false
            },
            {
              "option_id": 2,
              "is_selected": true
            },
            {
              "option_id": 3,
              "is_selected": true
            },
            {
              "option_id": 4,
              "is_selected": false
            },
        ],

can you tell me what data type the list should be

CodePudding user response:

You can use json_serializable. Create some Dart object and convert them in to json.

And freezed is better too.

Here is an article show you how to use code generation and json serialize in dart.

CodePudding user response:

You should create a custom object. Then use a parse json function to manage it.

It’s better if you understand what is object oriented programming.

  • Related