0

while executing below query in flutter in ios its working but in android getting below exception.

Unhandled Exception: DatabaseException(no such function: JSON_EXTRACT (code 1)

query: SELECT * from ITEM WHERE JSON_EXTRACT(ITEM.attr, '$.t2') = '76d9fdf2-22b7-4b42-b597-74359a694644'

  • What is this for? SQLite? An API? This needs code and details before we can hope to figure out the problem and offer a solution. – Abion47 Jan 22 '20 at 09:46
  • I'm trying to access a record stored in SQLite database, using the above mentioned query. The record is saved in JSON format, hence need JSON_EXTRACT query. I'm sure the query is correct as its working in iOS, but not on android. @Abion47 – ASHIM SAINI Jan 22 '20 at 12:19
  • SQLite doesn't support the JSON format natively. If it's working for iOS, I have no idea why. (Maybe the iOS side of sqflite has an extension enabled while the android side doesn't, for some reason.) Also, maybe the iOS side is "working" only in that it isn't throwing any errors but isn't actually returning the data as expected. – Abion47 Jan 22 '20 at 17:28

1 Answers1

1

JSON_EXTRACT is part of the json1 extension. This means that it may or may not be present on the device, depending on the manufacturer or OS version.

In theory, you could add the extension during the native Android or iOS compilation process. Some other user tried that in this stackoverflow question, but had no success.

npace
  • 4,218
  • 1
  • 25
  • 35