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
| GEMINI_API_KEY= | |
| LOCAL_LLM_BASE_URL= |
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
| // Creating cache folder where our response will be cached | |
| val cacheFolder = Cache(File(applicationContext.cacheDir, "http-cache"), 10L * 1024L * 1024L) // 10 MB Cache | |
| // Creating the okhttp builder passing the CacheInterceptor that adds "Cache-Control" in server's header | |
| val okHttpClient = OkHttpClient().newBuilder() | |
| .cache(cacheFolder) | |
| .addNetworkInterceptor(CacheInterceptor()) // Only intercepts network responses (i.e. responses fetched from the server, not the cache) | |
| .build() |
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
| // The following code is referenced from the sources below. I encourage you to review + debug it yourself to get a better understanding. | |
| // https://github.com/square/okhttp/issues/350#issuecomment-123105641 | |
| // https://github.com/square/okhttp/blob/f4ff4f4a8dce5f44596115f9564280e41d845f98/samples/guide/src/main/java/okhttp3/recipes/RequestBodyCompression.java#L73 | |
| private class GzipRequestInterceptor : Interceptor { | |
| override fun intercept(chain: Interceptor.Chain): Response { | |
| val originalRequest = chain.request() | |
| val body = originalRequest.body | |
| if (body == null || originalRequest.header("Content-Encoding") != null |
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
| #!/bin/bash | |
| # Update Gradle, Java and other Android project settings in a Flutter project | |
| # See: https://gradle.org/releases/ | |
| DESIRED_GRADLE_VERSION="8.9" | |
| # Build errors often show the required Java version | |
| DESIRED_JAVA_VERSION="17" | |
| # See: https://developer.android.com/ndk/downloads | |
| DESIRED_NDK_VERSION="27.0.12077973" | |
| # The minimum Android SDK version |
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
| @OptIn(ExperimentalMaterialApi::class) | |
| @Composable | |
| fun PullToRefreshAnimation() { | |
| val path = remember { | |
| GitHubLogoPath.path.toPath() | |
| } | |
| val lines = remember { | |
| path.asAndroidPath().flatten(error = 0.5f).toList() | |
| } |
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 com.google.gson.Gson | |
| import com.google.gson.GsonBuilder | |
| import com.google.gson.TypeAdapter | |
| import com.google.gson.TypeAdapterFactory | |
| import com.google.gson.reflect.TypeToken | |
| import com.google.gson.stream.JsonReader | |
| import com.google.gson.stream.JsonWriter | |
| import kotlin.jvm.internal.Reflection | |
| import kotlin.reflect.KClass |
- Open android studio Tools->Flutter->Clean
- Go to File -> Invalidate Caches / Restart
- Or open terminal run "flutter clean"
- Remove pubspec.lock
- Double check the Flutter SDK Path config correcty - https://tppr.me/qn6dP
Or open the terminal and try this script:
flutter clean
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 'dart:math'; | |
| void main() async { | |
| var duration = _runCPUBoundTask(); | |
| print('The duration for CPU bound task is $duration'); | |
| } | |
| Future<Duration> _runCPUBoundTask() async { | |
| var startTime = DateTime.now(); | |
| print('Starting ...'); |
NewerOlder