Skip to content

Commit

Permalink
date
Browse files Browse the repository at this point in the history
  • Loading branch information
pr-1 committed Jun 29, 2020
1 parent 218f640 commit 1624855
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/stores/news_store/newsstore.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import 'dart:convert';
import 'package:hack20_atomica/models/news_model.dart';
import 'package:mobx/mobx.dart';
import 'package:http/http.dart' as http;

import 'package:intl/intl.dart';
part 'newsstore.g.dart';
class NewsStore = _NewsStore with _$NewsStore;

Expand All @@ -22,7 +22,8 @@ abstract class _NewsStore with Store {

@action
getNews() async {
var url = 'http://newsapi.org/v2/everything?q=earth&from=2020-05-29&sortBy=publishedAt&apiKey=680f2aeff8ad42b1a8cc578b5a8a6e01';
DateFormat.yMd().format(new DateTime.now());
var url = 'http://newsapi.org/v2/everything?q=earth&from=${DateFormat.yMd().format(new DateTime.now())}&sortBy=publishedAt&apiKey=680f2aeff8ad42b1a8cc578b5a8a6e01';
var response = await http.get(url);
print('Response status: ${response.statusCode}');
print('Response body: ${response.body}');
Expand Down
7 changes: 7 additions & 0 deletions pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -380,6 +380,13 @@ packages:
url: "https://pub.dartlang.org"
source: hosted
version: "3.1.4"
intl:
dependency: "direct main"
description:
name: intl
url: "https://pub.dartlang.org"
source: hosted
version: "0.16.1"
io:
dependency: transitive
description:
Expand Down
1 change: 1 addition & 0 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ dependencies:
http: 0.12.1
url_launcher: 5.4.11
flutter_sparkline: 0.1.0
intl: ^0.16.1

dev_dependencies:
flutter_test:
Expand Down

0 comments on commit 1624855

Please sign in to comment.