Skip to content

Commit 2c0878c

Browse files
authored
fix(datastore): cannot saving boolean as integer in SQLite (#754)
* fix(datastore): cannot saving boolean as integer in SQLite * fix unit test * Apply the fix to double type field as well
1 parent 2654d56 commit 2c0878c

File tree

2 files changed

+4
-4
lines changed
  • packages/amplify_datastore/android/src

2 files changed

+4
-4
lines changed

packages/amplify_datastore/android/src/main/kotlin/com/amazonaws/amplify/amplify_datastore/types/model/FlutterModelFieldType.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,12 +59,12 @@ data class FlutterModelFieldType(val map: Map<String, Any>) {
5959
return when (fieldType) {
6060
"string" -> String::class.java
6161
"int" -> Integer::class.java
62-
"double" -> Double::class.java
62+
"double" -> Double::class.javaObjectType
6363
"date" -> Temporal.Date::class.java
6464
"dateTime" -> Temporal.DateTime::class.java
6565
"time" -> Temporal.Time::class.java
6666
"timestamp" -> Temporal.Timestamp::class.java
67-
"bool" -> Boolean::class.java
67+
"bool" -> Boolean::class.javaObjectType
6868
"enumeration" -> String::class.java
6969
"model" -> Model::class.java
7070
"collection" -> List::class.java

packages/amplify_datastore/android/src/test/kotlin/com/amazonaws/amplify/amplify_datastore/SchemaData.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -266,15 +266,15 @@ val allTypeModelSchema = ModelSchema.builder()
266266
"floatType" to
267267
ModelField.builder()
268268
.name("floatType")
269-
.javaClassForValue(Double::class.java)
269+
.javaClassForValue(Double::class.javaObjectType)
270270
.targetType("Double")
271271
.isRequired(true)
272272
.isArray(false)
273273
.build(),
274274
"boolType" to
275275
ModelField.builder()
276276
.name("boolType")
277-
.javaClassForValue(Boolean::class.java)
277+
.javaClassForValue(Boolean::class.javaObjectType)
278278
.targetType("Boolean")
279279
.isRequired(true)
280280
.isArray(false)

0 commit comments

Comments
 (0)