void main() async {
final wp = WordPressAPI('https://jsonplaceholder.typicode.com/posts');
final posts = await wp.getPosts();
for (final post in posts) {
print(post.title['rendered']);
}
}
But always return 404:
Exception: DioError [DioErrorType.RESPONSE]: Http status error [404]
This package is a WordPress API wrapper and can only be used with a WordPress site. 'https://jsonplaceholder.typicode.com is not a WordPress powered website.
I'm try do work with the sample: import 'package:wordpress_api/wordpress_api.dart';
WordPressAPI api = WordPressAPI('https://jsonplaceholder.typicode.com/');
void main() async { final wp = WordPressAPI('https://jsonplaceholder.typicode.com/posts'); final posts = await wp.getPosts(); for (final post in posts) { print(post.title['rendered']); } } But always return 404: Exception: DioError [DioErrorType.RESPONSE]: Http status error [404]
0 WordPressAPI.getAsyc (package:wordpress_api/src/main.dart:249:7)