Asynkio : Write asynced IO/ Network calls painlessly on android
| | | Documentation
Write your network requests, IO calls in android with Kotlin seamlessly. Asynkio Inspired by python's asyncio
What I mean is..
async {
//All network requests on couroutines
val response = await {
//Get the data
val resp = get("https://awesome.com/lib", params = mapOf("lib" to "Asynkio"))
//Post the data
return@await post("https://youareonfire.com/lib", data = mapOf("id" to resp.jsonObject["id"]))
}
//Process the result on UI thread
if (response.statusCode == 200){
yoTextView.text = response.text
}
}
Yes, that's it. No retrofit. No Volley. Java/Kotlin are very bad at handling the http requests, but still Asynkio
is the optimal way. No extra overhead, Seriously...No bullshit!
Another example
async {
filename = await {
longRunningFileOperation(content)
}
}.onError {
Toast.makeText(context, "Oops ! it failed",Toast.LENGTH_LONG).show()
}.finally {
closeTheFile(filename)
}
Want to use it? Checkout full documentation over here Getting Started
Implementation
Gradle
implementation 'me.nikhilchaudhari:asynkio:{latest-version}'
Maven
<dependency>
<groupId>me.nikhilchaudhari</groupId>
<artifactId>asynkio</artifactId>
<version>{latest-version}</version>
<type>pom</type>
</dependency>
Please check releases for latest version
Documentation
- Home
- Getting Started
- Network Requests
- Headers
- Parsing Response
- Manipulating Response
- Handling Multipart Data
-
Advanced
- LiveData and RxJava Support
Copyright 2019 @ Nikhil Chaudhari
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.