Flutter开发之——json序列化,我先收藏为敬

}

@JsonSerializable()

class ArticleData {

int curPage;

int offset;

bool over;

int pageCount;

int size;

int total;

List datas;

ArticleData(this.curPage, this.offset, this.over, this.pageCount, this.size, this.total, this.datas);

factory ArticleData.fromJson(Map<String, dynamic> json) => _$ArticleDataFromJson(json);

Map<String, dynamic> toJson() => _$ArticleDataToJson(this);

}

@JsonSerializable()

class Person {

String apkLink;

int audit;

String author;

bool canEdit;

int chapterId;

String chapterName;

bool collect;

int courseId;

String desc;

String descMd;

String envelopePic;

bool fresh;

String host;

int id;

String link;

String niceDate;

String niceShareDate;

String origin;

String prefix;

String projectLink;

int publishTime;

int realSuperChapterId;

int selfVisible;

int shareDate;

String shareUser;

int superChapterId;

String superChapterName;

List tags;

String title;

int type;

int userId;

int visible;

int zan;

Person(

this.apkLink,

this.audit,

this.author,

this.canEdit,

this.chapterId,

this.chapterName,

this.collect,

this.courseId,

this.desc,

this.descMd,

this.envelopePic,

this.fresh,

this.host,

this.id,

this.link,

this.niceDate,

this.niceShareDate,

this.origin,

this.prefix,

this.projectLink,

this.publishTime,

this.realSuperChapterId,

this.selfVisible,

this.shareDate,

this.shareUser,

this.superChapterId,

this.superChapterName,

this.tags,

this.title,

this.type,

this.userId,

this.visible,

this.zan);

factory Person.fromJson(Map<String, dynamic> json) => _$PersonFromJson(json);

Map<String, dynamic> toJson() => _$PersonToJson(this);

}

@JsonSerializable()

class Tag {

String name;

String url;

Tag(this.name, this.url);

factory Tag.fromJson(Map<String, dynamic> json) => _$TagFromJson(json);

Map<String, dynamic> toJson() => _$TagToJson(this);

}

注意:

  • 添加part 'Article.g.dart';其中:Article是dart文件名,文件名+g.dart格式

  • 在每个需要序列化的类前面添加@JsonSerializable(),如类:ArticleArticleDataPersonTag

  • 每个类里面有:变量,构造函数,类名.fromJson() => _$类名FromJson(json)toJson() => _$类名ToJson(this)

3.3 生成序列化类.g.dart文件

自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。

深知大多数Android工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!

因此收集整理了一份《2024年Android移动开发全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。
img
img
img
img
img
img
img

既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Android开发知识点,真正体系化!

由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新

如果你觉得这些内容对你有帮助,可以添加V获取:vip204888 (备注Android)
img

最后看一下学习需要的所有知识点的思维导图。在刚刚那份学习笔记里包含了下面知识点所有内容!文章里已经展示了部分!如果你正愁这块不知道如何学习或者想提升学习这块知识的学习效率,那么这份学习笔记绝对是你的秘密武器!

续会持续更新**

如果你觉得这些内容对你有帮助,可以添加V获取:vip204888 (备注Android)
[外链图片转存中…(img-1NDExSMH-1711645425284)]

最后看一下学习需要的所有知识点的思维导图。在刚刚那份学习笔记里包含了下面知识点所有内容!文章里已经展示了部分!如果你正愁这块不知道如何学习或者想提升学习这块知识的学习效率,那么这份学习笔记绝对是你的秘密武器!

[外链图片转存中…(img-W1gFZyh5-1711645425284)]

本文已被CODING开源项目:《Android学习笔记总结+移动架构视频+大厂面试真题+项目实战源码》收录

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值