This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.codingwitharul.bookmyslot.common | |
| import io.ktor.client.HttpClient | |
| import io.ktor.client.HttpClientConfig | |
| import io.ktor.client.engine.darwin.Darwin | |
| import io.ktor.client.plugins.HttpTimeout | |
| import io.ktor.client.plugins.contentnegotiation.ContentNegotiation | |
| import io.ktor.client.plugins.defaultRequest | |
| import io.ktor.client.request.header | |
| import io.ktor.serialization.kotlinx.json.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.codingwitharul.bookmyslot.common | |
| import io.ktor.client.HttpClient | |
| import io.ktor.client.HttpClientConfig | |
| import io.ktor.client.engine.okhttp.OkHttp | |
| import io.ktor.client.plugins.HttpTimeout | |
| import io.ktor.client.plugins.contentnegotiation.ContentNegotiation | |
| import io.ktor.client.plugins.defaultRequest | |
| import io.ktor.client.request.header | |
| import io.ktor.serialization.kotlinx.json.json |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.codingwitharul.bookmyslot.common | |
| import io.ktor.client.HttpClient | |
| import io.ktor.client.HttpClientConfig | |
| expect fun httpClient(config: HttpClientConfig<*>.() -> Unit = {}): HttpClient |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.codingwitharul.bookmyslot.data.networking | |
| import com.codingwitharul.bookmyslot.common.httpClient | |
| import com.codingwitharul.bookmyslot.data.db.DatabaseHelper | |
| import com.codingwitharul.bookmyslot.db.UserInfo | |
| import com.codingwitharul.bookmyslot.data.networking.models.ApiResponse | |
| import io.github.aakira.napier.Napier | |
| import io.ktor.client.HttpClient | |
| import io.ktor.client.call.body | |
| import io.ktor.client.plugins.ClientRequestException |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.codingwitharul.bookmyslot.data.networking | |
| internal object Constants { | |
| const val HOST = "https://642d737e66a20ec9ce9de798.mockapi.io/api/v1/" | |
| } | |
| internal object EndPoints { | |
| const val Auth = "auth" | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| package com.codingwitharul.bookmyslot.data.networking.models | |
| import kotlinx.serialization.SerialName | |
| import kotlinx.serialization.Serializable | |
| sealed class ApiResponse<out T, out E> { | |
| /** | |
| * Represents successful network responses (2xx). | |
| */ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| shared/ | |
| ├── commonMain | |
| | /common/ your shared code + Ktor setup | |
| | └── data | |
| | ├── db | |
| | └── networking | |
| | └── models | |
| | | > ApiResponse.kt | |
| | ├── ApiClientHelper.kt | |
| | └── Constants.kt |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import 'package:myapp/src/values/colors.dart'; | |
| import 'package:flutter/material.dart'; | |
| class RatingBar extends StatefulWidget { | |
| final double rating; | |
| final bool makeRating; | |
| final double? size; | |
| final Function(double rating)? makeRatingCallback; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MvvmRepo { | |
| Future<String> getWelcomeText() { | |
| // | |
| // from storage or Network | |
| // | |
| return Future.value("Puppy"); | |
| } | |
| //... other methods |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| class MvvmViewModel with ChangeNotifier { | |
| String welcomeText = ""; | |
| final MvvmRepo repo; | |
| MvvmViewModel(this.repo) { | |
| loadWelcomeText(); | |
| } |