flutterdartdependenciesversioningrecord

How do I specify the correct record dependency version for my Flutter app in VSCode?


I want the app to record the user's voice and send it to a CSV file (Google Sheets). I have it working for user input so far. In my "pubspec.yaml" file, I've defined the record, permission_handler and path_provider dependencies. However, after testing the record and path_provider dependency versions are causing my run to crash. Preferably, I want the solution to use the record dependency.

My Flutter version is 3.24.0, Dart version is 3.5.0.

Here is the snippet from my pubspec.yaml file that's causing the errors:

  flutter:
    sdk: flutter
  cupertino_icons: ^1.0.8
  csv: ^6.0.0
  http: ^1.2.2

  # need to get the following 3 dependencies working
  #record: ^5.0.4
  #permission_handler: ^11.3.0
  #path_provider: ^2.1.2

  # solution 1
  #flutter_audio_recorder2: ^0.0.2

  # solution 2
  #flutter_sound: ^9.1.8

This is my build.gradle file:

allprojects {
    repositories {
        google()
        mavenCentral()
    }
}

rootProject.buildDir = "../build"
subprojects {
    project.buildDir = "${rootProject.buildDir}/${project.name}"
}
subprojects {
    project.evaluationDependsOn(":app")
}

tasks.register("clean", Delete) {
    delete rootProject.buildDir
}

There's also a 2nd build.gradle file:

plugins {
    id "com.android.application"
    id "kotlin-android"
    // The Flutter Gradle Plugin must be applied after the Android and Kotlin Gradle plugins.
    id "dev.flutter.flutter-gradle-plugin"
}


android {
    namespace = "com.example.test_application_2"
    compileSdk = flutter.compileSdkVersion
    ndkVersion = flutter.ndkVersion

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_8
        targetCompatibility = JavaVersion.VERSION_1_8
    }

    kotlinOptions {
        jvmTarget = JavaVersion.VERSION_1_8
    }

    
    defaultConfig {
        // TODO: Specify your own unique Application ID (https://developer.android.com/studio/build/application-id.html).
        applicationId = "com.example.test_application_2"
        // You can update the following values to match your application needs.
        // For more information, see: https://flutter.dev/to/review-gradle-config.
        minSdkVersion flutter.minSdkVersion// changed from flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }

    buildTypes {
        release {
            // TODO: Add your own signing config for the release build.
            // Signing with the debug keys for now, so `flutter run --release` works.
            signingConfig = signingConfigs.debug
        }
    }

flutter {
    source = "../.."
}
}

Solution

  • defaultConfig {
        applicationId = "com.example.test_application_2"
        minSdkVersion = flutter.minSdkVersion
        targetSdk = flutter.targetSdkVersion
        versionCode = flutter.versionCode
        versionName = flutter.versionName
    }
    

    In your code, there isn't a = after minSdk