nathanbaleeta / ureport_mobile

U-Report is a social messaging tool and data collection system developed by UNICEF to improve citizen engagement, inform leaders, and foster positive change. The program sends polls and alerts to its participants, collecting real-time responses, and subsequently publishes gathered data.
https://ureport.in/
GNU General Public License v3.0
6 stars 1 forks source link

Create a Story class as a custom Dart object #12

Closed nathanbaleeta closed 4 years ago

nathanbaleeta commented 4 years ago

While retrieving stories from the U-Report public API stories endpoint, to make your life easier, convert the http.Response into a Dart object.

First, create a Story class in model directory that contains the API data from the network request. It includes a factory constructor that creates a Story from JSON. It includes the following data fields:


       {
        "id": Integer,
        "title": "String.",
        "featured": Bolean,
        "summary": "String",
        "video_id": Integer,
        "audio_link": String,
        "tags": " String ",
        "org": Integer,
        "images": ["String"],
        "category": {
            "image_url": "String",
            "name": "String"
        },
        "created_on": "datetime"
       }