map method
Maps the given row returned by the database into the fitting data class.
Implementation
@override
Node map(Map<String, dynamic> data, {String? tablePrefix}) {
final effectivePrefix = tablePrefix != null ? '$tablePrefix.' : '';
return Node(
nodeId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}node_id'],
)!,
role: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}role'],
)!,
groupId: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}group_id'],
),
lastSeen: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}last_seen'],
)!,
hopCount: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}hop_count'],
)!,
displayName: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}display_name'],
),
batteryLevel: attachedDatabase.typeMapping.read(
DriftSqlType.int,
data['${effectivePrefix}battery_level'],
),
hasInternetAccess: attachedDatabase.typeMapping.read(
DriftSqlType.bool,
data['${effectivePrefix}has_internet_access'],
)!,
metadata: attachedDatabase.typeMapping.read(
DriftSqlType.string,
data['${effectivePrefix}metadata'],
),
);
}