1
0
mirror of https://github.com/nisrulz/flutter-examples.git synced 2026-06-09 15:39:42 +00:00

[Fixes #97] Added a News & Memes App (#99)

* Added a News&Memes-App/Sriraj-dev

* Added Screen recording and Screenshots

* Update README.md

* Added demo directory with sample images/recording

* Update README.md
This commit is contained in:
Sriraj
2022-10-22 23:52:33 +05:30
committed by GitHub
parent 52a150d66b
commit 59ec36a48a
74 changed files with 1692 additions and 0 deletions

View File

@@ -0,0 +1,20 @@
import 'dart:convert';
import 'package:http/http.dart' as http;
Future<List<dynamic>> showMemes() async {
Uri uri = Uri.parse('https://meme-api.herokuapp.com/gimme/10');
final response = await http.get(uri);
if (response.statusCode == 200 || response.statusCode == 201) {
print(response.body);
Map<String, dynamic> map = json.decode(response.body);
List<dynamic> memes = map['memes'];
List<dynamic> memeUrls =
memes.map((e) => e['preview'][e['preview'].length - 1]).toList();
return memeUrls;
} else {
print('Error - ${response.statusCode}');
return [''];
}
}