How to search realm schema by objectId in flutter

this is my schema import ‘package:realm/realm.dart’;
import ‘dart:io’;

part ‘shops.g.dart’;

@RealmModel()
@MapTo(“shops”)
class _Shops {
@PrimaryKey()
@MapTo(“_id”)
late ObjectId id;
late String shopName;
late String shopRegisterNumber;
late String ownerName;
late String phoneNumber;
late String shopAddress;
late ObjectId currency;
late String status;
late ObjectId createdBy;
late DateTime createdAt;
late DateTime updatedAt;
}
this is my query ObjectId objectId = ObjectId.fromHexString(‘65ecab5004c8c655189e4df9’);

final res = realm.query(“createdBy == $objectId”); for this i got errors like this
why this happen if i use this way ObjectId objectId = ObjectId.fromHexString(‘65ecab5004c8c655189e4df9’);

final res = realm.query(“createdBy == ‘$objectId’”); got this RealmException: Error code: 1009 . Message: Unsupported comparison between type ‘objectId’ and type ‘string’ please give solution for this

Refer to this docs page about passing in parameters to a query.