CanMessage class

A wrapper around a NativeCanMessage.

This class allows you to handle CAN frames allocated natively, or allocate them yourself. When allocating natively, use CanMessage(). When receiving a pointer to NativeCanMessage, use CanMessage.fromPointer.

Be sure to call dispose when you're done with the message. Once disposed, the fields of this class will return garbage data or segfault, so you should be careful to only dispose when you are truly done with the message.

Implemented types

Constructors

CanMessage({required int id, required List<int> data})
Allocates a NativeCanMessage and holds a reference to its pointer.
factory
CanMessage.fromPointer(Pointer<NativeCanMessage> pointer, {required bool isNative})
Stores a reference to a NativeCanMessage and where it was allocated.

Properties

data List<int>
Allows you to access a native char* as a Uint8List.
no setter
hashCode int
The hash code for this object.
no setterinherited
id int
The ID of the message.
no setter
isNative bool
Whether the resources were allocated by Dart or natively, which deteremines how to dispose.
final
length int
The length of the message.
no setter
pointer Pointer<NativeCanMessage>
The pointer to the NativeCanMessage struct backing this object.
final
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

dispose() → void
Frees the CanMessage struct that was natively allocated.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited