📜  PODO - 任何代码示例

📅  最后修改于: 2022-03-11 14:57:00.690000             🧑  作者: Mango

代码示例1
class post {

  int userId ;
  int id ;
  String title ;
  String body ;

  post({required this.userId , required this.id , required this.title , required this.body}) ;

  factory post.fromJson(Map  json) { //json is the map
    return post(
      userId : json ['userId'], //json ['userId'] this what we get from json and but it in the useId befor the :
      id : json ['id'],
      title : json['title'],
        body : json ['body']
    );
  }
}