hive
hive copied to clipboard
Getting ... (Three Dots) In Middle Of Data While Reading An Entire Data Modal
Question I am getting three dots (...) in middle of my data returning from data modal when it is greater than 5 that is not desirable. Can you mention why this is happening? See the below example when data is return then when I have 5 objects then it is working fine but more then 5 it started add ... in middle of return data.
Return Data Sample
BULK OFFLINE LOCATION DATA TO SENT: ({"organisation_id":"1","jobId":"2876","loc":{"lat":"24.9517451","lng":"67.1229547","actiontime":"2022-06-10 17:46:07"}}, {"organisation_id":"1","jobId":"2876","loc":{"lat":"24.9517434","lng":"67.1229546","actiontime":"2022-06-10 17:46:12"}}, {"organisation_id":"1","jobId":"2876","loc":{"lat":"24.951744","lng":"67.1229551","actiontime":"2022-06-10 17:46:17"}}, {"organisation_id":"1","jobId":"2876","loc":{"lat":"24.9517395","lng":"67.1229525","actiontime":"2022-06-10 17:46:23"}}, {"organisation_id":"1","jobId":"2876","loc":{"lat":"24.9517395","lng":"67.1229525","actiontime":"2022-06-10 17:46:27"}})
BULK OFFLINE LOCATION DATA TO SENT: ({"organisation_id":"1","jobId":"2876","loc":{"lat":"24.9517451","lng":"67.1229547","actiontime":"2022-06-10 17:46:07"}}, {"organisation_id":"1","jobId":"2876","loc":{"lat":"24.9517434","lng":"67.1229546","actiontime":"2022-06-10 17:46:12"}}, {"organisation_id":"1","jobId":"2876","loc":{"lat":"24.951744","lng":"67.1229551","actiontime":"2022-06-10 17:46:17"}}, ..., {"organisation_id":"1","jobId":"2876","loc":{"lat":"24.9517395","lng":"67.1229525","actiontime":"2022-06-10 17:46:27"}}, {"organisation_id":"1","jobId":"2876","loc":{"lat":"24.9517409","lng":"67.1229539","actiontime":"2022-06-10 17:46:32"}})
Modal (session_locations.dart)
import 'dart:convert';
import 'dart:io';
import 'package:hive/hive.dart';
part 'session_locations.g.dart';
@HiveType(typeId: 1)
class SessionLocations {
SessionLocations({this.organisation_id, this.jobId, this.loc});
@HiveField(0)
String? organisation_id;
@HiveField(1)
String? jobId;
@HiveField(2)
Map<String,String>? loc;
@override
String toString() {
return jsonEncode({
'organisation_id': this.organisation_id,
'jobId': this.jobId,
'loc': this.loc
});
}
}
Modal G File (session_locations.g.dart)
// GENERATED CODE - DO NOT MODIFY BY HAND
part of 'session_locations.dart';
// **************************************************************************
// TypeAdapterGenerator
// **************************************************************************
class SessionLocationsAdapter extends TypeAdapter<SessionLocations> {
@override
final int typeId = 1;
@override
SessionLocations read(BinaryReader reader) {
final numOfFields = reader.readByte();
final fields = <int, dynamic>{
for (int i = 0; i < numOfFields; i++) reader.readByte(): reader.read(),
};
return SessionLocations(
organisation_id: fields[0] as String?,
jobId: fields[1] as String?,
loc: (fields[2] as Map?)?.cast<String, String>(),
);
}
@override
void write(BinaryWriter writer, SessionLocations obj) {
writer
..writeByte(3)
..writeByte(0)
..write(obj.organisation_id)
..writeByte(1)
..write(obj.jobId)
..writeByte(2)
..write(obj.loc);
}
@override
int get hashCode => typeId.hashCode;
@override
bool operator ==(Object other) =>
identical(this, other) ||
other is SessionLocationsAdapter &&
runtimeType == other.runtimeType &&
typeId == other.typeId;
}
Reading Code
if (!Hive.isAdapterRegistered(1)) {Hive.registerAdapter(SessionLocationsAdapter());}
var offlineSessionLocations_DB = await Hive.openBox('offlineSessionLocations');
print("BULK OFFLINE LOCATION DATA TO SENT: ${offlineSessionLocations_DB.values.toString()}");
Version
- hive: ^2.2.1
- hive_flutter: ^1.1.0
- path_provider: ^2.0.11
% flutter doctor
Doctor summary (to see all details, run flutter doctor -v):
[✓] Flutter (Channel stable, 2.10.5, on macOS 12.4 21F79 darwin-arm, locale en-GB)
[✓] Android toolchain - develop for Android devices (Android SDK version 32.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.2.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] Connected device (2 available)
[✓] HTTP Host Availability
• No issues found!