Skip to content

Task :flutter_contacts:lintDebug FAILED - getColumnIndex can be -1 [Range] #204

@pontfort

Description

@pontfort

When i execute ./gradlew build, i have this error :

Task :flutter_contacts:lintDebug FAILED
Lint found 21 errors, 11 warnings. First failure:

E:\PUB_CACHE\hosted\pub.dev\flutter_contacts-1.1.9+2\android\src\main\kotlin\co\quis\flutter_contacts\FlutterContacts.kt:75: Error: Value must be  0 but getColumnIndex can be -1 [Range]
fun getString(col: String): String = cursor.getString(cursor.getColumnIndex(col)) ?: ""

If i ignore the error this this configuration on build.gradle, i have ths same error :
android {
lint {
checkReleaseBuilds false
abortOnError false
}
}

A solution on code to modify :
...\flutter_contacts-1.1.9+2\android\src\main\kotlin\co\quis\flutter_contacts\FlutterContacts.kt:75
fun getString(col: String): String {
val index = cursor.getColumnIndex(col)
return if (index >= 0) cursor.getString(index) ?: "" else ""
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions