Flutter WordPress This library uses WordPress REST API V2 to provide a way for your application to interact with your WordPress website.
FlutterBloc The package FlutterBloc provides widgets to facilitate the connection between the logic layer and the ui layer. One of these is BlocProvider, which is like Provider but it handles overhead for the Bloc like creating and disposing things when necessary. The key to embedding your Flutter app in WordPress is to use an IFrame. An IFrame allows you to embed content from another website, which is what your Flutter app is. Open a WordPress page in Edit. Be the first to review “Flutter WordPress” Cancel reply. Your email address will not be published. Required fields are marked. Your rating. Flutter offers a fast development cycle with Stateful Hot Reload, the ability to reload the code of a live running app without restarting or losing app state. Make a change to app source, tell your IDE or command-line tool that you want to hot reload, and see the change in your simulator, emulator, or device.
Introduction
Welcome to the documentation for WP JSON API for Flutter!
Here you'll be able to learn how it works and explore the features available.
If you have any questions please feel free to contact us
Requirements
To quickly get set up, you'll need to ensure that you have the below requirements.
WordPress 4.0+
Woocommerce Store 3.0+ (Optional)
Flutter
Installing the Plugin
Follow the below steps to install the plugin on your WordPress site:
Login into your WooSignal account (or create an account if you are new).
Once you reach the Dashboard, on the left nav bar look for 'Plugins' and click the link.
After downloading the plugin, visit your WordPress site and login to get to your admin dashboard. On your nav bar, look for 'Plugins' like the below image.
Select 'Add New' and proceed to the next step below.
Then select 'Upload plugin' like the below image
This will open a box below where you can upload a .zip file.
Click 'Choose file' can look for the WooSignal plugin you downloaded and select the .zip file to install. After you select 'Install Now'. You should then be able to activate the plugin from your WordPress admin to start using it.
If you followed all the steps above you should now be ready to start using the plugin in Flutter.
Next
Install the Flutter package
Add the following line to your pubspec.yaml file
2. Install it
You can install packages from the command line:
Error handling
If the request payload 'status' returns a value higher than 200 then an error has happened.
When an error occurs with an API request, the expected object response will return as null.
Initializing WPJson in Flutter
In your main.dart file create a new instance of WPJsonAPI like the following example below
Get Nonce
Returns a nonce token from WordPress, use the response token for logging in and registering new users.
Method
Returns WPNonceResponse | null
Verify Nonce
Returns the bool value if a nonce is still valid to use.
Method
Body Parameters
Returns WPNonceVerifiedResponse | null
Register a user
Register a user on WordPress
Method
Body Parameters
Returns WPUserRegisterResponse | null
WordPress Login
Login as a user on WordPress, this returns a userToken that you can use for future requests.
Method
Body Parameters
Returns WPUserLoginResponse | null
WordPress Users Info
Returns a users info from WordPress
Method
Returns WPUserInfoResponse | null
Update Users Info
Update an authenticated users info
Method
Returns WPUserInfoUpdatedResponse | null
Update Users Password
Update an authenticated users password
Method
Body Parameters
Returns WPUserResetPasswordResponse | null
API Requests: WooCommerce
WooCommerce Get Users Info
Returns a customers info from WooCommerce, we include the billing and shipping
Method
Flutter With Wordpress
Returns WCCustomerInfoResponse | null
WooCommerce Update Users Info
Send the fields you want to update and the plugin will handle the rest
Method
Body Parameters
Returns WCCustomerUpdatedResponse | null
A flutter app for a wordpress based news website (https://flutterblog.crumet.com/).
You need to have a wordpress website before you implement the app.
Flutter Wordpress App
If you have wordpress website already then follow the simple steps given below to build your own WordPress Flutter App.
Edit your wordpress theme
Update the wordpress functions.php file on your theme by appending the following code at the end. The app will not function correctly if this step is not followed.
Edit the constants
Change the constants from the ./lib/common/constants.dart file. For the categories name and ID refer to your wordpress website.
Push Notification (Optional)
This project uses firebase messenging for push notification.
To integrate push notification from firebase follow the steps:
- Go to firebase console
- Generate and Download google-services.json file
- Place google-services.json file inside android/app
- It should be ready now. Test your push notification.
For further instruction read documentation from https://pub.dev/packages/firebase_messaging
Released under the MIT License.