You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm trying to get posts from wordpress and i'm not getting response back. i'm running latest version of the library. Am i missing something? Sorry still learning flutter. Future<ResponseContainer<List<Post?>?>> getPosts() async { WordpressClient client; client = new WordpressClient('https://{obfiscatedurl}/wp-json', 'wp/v2'); ResponseContainer<List<Post?>?> posts = await client.posts .list((builder) => builder.withPerPage(20).withPageNumber(1).build()); print(posts.value!.first!.id); return posts; }
The text was updated successfully, but these errors were encountered:
I am having trouble understanding the issue.
The request code is correct. I am guessing there is either some exception being thrown internally or your Wordpress api isn't responding with valid data. (An array of posts in this case.)
Few methods which will help you with identifying the actual problem:
Use postman to manually send a GET Request to Wordpress post list endpoint. https://www.replaceme.com/wp-json/wp/v2/posts or better yet, simply copy paste this url into your browser address bar. (After replacing replaceme.com with your domain ofc)
Register Response/Request callbacks which is available to you during building process of a request.
Add Response preprocessor to get the raw response which is returned from the server.
I'm trying to get posts from wordpress and i'm not getting response back. i'm running latest version of the library. Am i missing something? Sorry still learning flutter.
Future<ResponseContainer<List<Post?>?>> getPosts() async { WordpressClient client; client = new WordpressClient('https://{obfiscatedurl}/wp-json', 'wp/v2'); ResponseContainer<List<Post?>?> posts = await client.posts .list((builder) => builder.withPerPage(20).withPageNumber(1).build()); print(posts.value!.first!.id); return posts; }
The text was updated successfully, but these errors were encountered: