- Notifications
You must be signed in to change notification settings - Fork1
The YouCan E-commerce platform SDK for Flutter/Dart, built for a better developer experience.
License
anasfik/Youcan_flutter_sdk
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A wrapper into the YouCan platform API that enables developers to extend its features inside a Dart/Flutter project
YOU CAN HELP THIS PROJECT MAINTAINED CONTINUOUSLY BY THE AUTHOR WITH A STAR ✨✨
Well, we might need a flexible and easy way to exchange requests from this API to our project, this could get developers more unnecessary extra work such as dealing with configuring and using the API's multiple endpoints, loose types of data, HTTP requests, modeling data...
This library aims to cover the developers from all those sides and provide easy call methods that bring them to their goals.
NOTE: This is still under development
Get the full documentation of all that this library offersfrom this link
To configure this library to get the data directly from your store, you will need to set it like this:
voidmain() {YouCan.instance.storeLink='https://example.youcan.shop';// change it with your store's link}
You can authenticate your customers to your store by calling thelogin()
andcreate()
methods on the customers instance like this:
// LoginString loginToken=awaitYouCan.instance.customers.login( email:"YOUR EMAIL HERE", password:"YOUR PASSWORD HERE", );// Sign Up.CustomerCreationResponse customerCreationResult=awaitYouCan.instance.customers.create( email:"YOUR EMAIL HERE", password:"YOUR PASSWORD HERE", confirmPassword:"THE PASSWORD CONFIRMATION HERE", );
To get a List` with all your store's products:
List<Product> products=awaitYouCan.instance.products.all();
You can also get a product's reviews asList<Review>
like this:
List<Product> products=awaitYouCan.instance.products.all();Product oneProduct= products.first;List<Review> review=await oneProduct.reviews();
to get all your store's categories asList<Category>
, you will need to do this:
List<Category> categories=awaitYouCan.instance.categories.all();
Search queries are made easy:
List<Product> products=awaitYouCan.instance.products.search("YOUR SEARCH TEXT").all();
Pagination queries are also made easy, this example will get us the second page's products :
List<Product> products=awaitYouCan.instance.products.pagination(2).all();
You can also limit the requested elements to a specific number
List<Product> products=awaitYouCan.instance.products.limit(10).all();
in brief, you can query your targets (products, reviews...) based on your store's implementation way, this means that you can query by categories, pages, and limiting elements... :
List<Product> products=awaitYouCan.instance.categories.category("Category id").products.pagination(2).limit(15).all();
You can get in contact with your users using thesendMessage()
:
bool isSent=awaitYouCan.instance.contact.sendMessage(email:'email',subject:'subject',message:'message',),
Our open-source project is making a difference in the E-commerce/Flutter community and we need your help to continue improving and expanding it. any kind of contribution is welcome.
Thank you!
MIT LicenseCopyright (c) 2023 GwhyyyPermission is hereby granted, free of charge, to any person obtaining a copyof this software and associated documentation files (the "Software"), to dealin the Software without restriction, including without limitation the rightsto use, copy, modify, merge, publish, distribute, sublicense, and/or sellcopies of the Software, and to permit persons to whom the Software isfurnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in allcopies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS ORIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THEAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHERLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THESOFTWARE.