Model Class // To parse this JSON data, do // // final welcome = welcomeFromJson(jsonString); import 'dart:convert' ; List<Welcome> welcomeFromJson (String str) => List <Welcome>. from (json.decode(str).map((x) => Welcome . fromJson (x))) ; String welcomeToJson (List<Welcome> data) => json.encode( List < dynamic >. from (data.map((x) => x.toJson()))) ; class Welcome { Welcome({ required this . userId , required this . id , required this . title , }) ; int userId ; int id ; String title ; factory Welcome. fromJson (Map<String , dynamic > json) => Welcome ( userId: json[ "userId" ] , id: json[ "id" ] , title: json[ "title" ] , ) ; Map<String , dynamic > toJson () => { "userId" : userId , "id" : id , "title" : title , } ; } Main Class // Importing important packages require to connect // Flutter and Dart import ...
Comments
Post a Comment