SaltechSystems / couchbase_lite

Flutter plugin for the Community edition of Couchbase Lite. Couchbase Lite is an embedded lightweight, document-oriented (NoSQL), syncable database engine.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

PlatformException(error, java.lang.Long cannot be cast to java.lang.Integer, null)

goxiaoy opened this issue · comments

when the data map contains a large integer (which is java's long), execute query on this field like


final Query query = QueryBuilder.select([SelectResult.all().from(_alias)])
        .from(_couchDb.dbName, as: _alias)
        .where(Expression.property("expireIn")
            .from(_alias)
            .lessThan(Expression.intValue(currentTime)));
    var retSet = await query.execute();

error occurs

Unhandled Exception: PlatformException(error, java.lang.Long cannot be cast to java.lang.Integer, null)
E/flutter (26935): #0      JSONMethodCodec.decodeEnvelope (package:flutter/src/services/message_codecs.dart:149:7)
E/flutter (26935): #1      MethodChannel.invokeMethod (package:flutter/src/services/platform_channel.dart:321:33)
E/flutter (26935): <asynchronous suspension>
E/flutter (26935): #2      Query.execute (package:couchbase_lite/src/query/query.dart:31:26)

I found a way out
just use
Expression.value(currentTime) instead of Expression.intValue(currentTime)
Should Expression.intValue check the value before send to channel?