nyt

一个崭新的 Flutter 项目。

入门

#介绍

这是一个使用Flutter开发的跨平台应用程序,支持IOS、Android和Web。

它用于获取纽约时报历年畅销书数据。

为入门项目提供了精心设计的UI/UX。

快来试试吧!

...
  String? source;
  String? title;
  String? url;
  String? image_url;
  String? description;
  String? published;
  String? content;

  News({this.source,this.title,this.url,this.image_url,this.description,this.published,this.content});

  News.fromJson(Map json):
    source=json['source']['name'],
    title=json['title'],
    url=json['url'],
    image_url = json['urlToImage'],
    description = json['description'],
    published = json['publishedAt'],
    content = json['content'];
...

fetchNewsFunc() async {
  try{
  Response response = await get(Uri.parse('https://newsapi.org/v2/everything?q=bitcoin&apiKey=2b3c34d8bafc4b21a0fa19e67ae7244b'));
  ...

  return dataFromApi;

  }catch(e) {
    ...
  }
}

GitHub

查看 Github