Adds a message channel built into Rid that is aside from the reply channel concerned with
handling replies to user messages sent to Rust.
This message channel supports sending message from rust to dart and is built into the rid
framework along with the following macros leveraging it:
rid:log_info, rid:log_debug, rid::log_warn to send messages to be logged in Dart
rid::error, rid::severe to report errors to dart
The log messages can then be handled on the Dart/Flutter side to output them via
print/debugPrint indicating that they come from Rust.
This will make debugging rid apps much easier.
For now I'll implement an example of doing this in the next example app and will think about
how/which parts can be added to rid proper to make using the message channel for logs easier.
The error messages are meant to be handled as follows:
error: print message + details to console and on Flutter show a Snackbar with the message
severe: print message + details to console and on Flutter show a banner on top of the
screen via showMaterialBanner with the message
These as well will be added to the example and I will see if an API to handle this as described
can be included with Rid in the future.
rid class
With these changes I introduced a Rid class accessible via rid on the Dart side.
It provides access to the rid.messageChannel and will include access to more features coming
in the future. I'm also considering adding the config properties like RID_LOG_DEBUG and such
to this class.
Adds a message channel built into Rid that is aside from the reply channel concerned with handling replies to user messages sent to Rust.
This message channel supports sending message from rust to dart and is built into the rid framework along with the following macros leveraging it:
rid:log_info
,rid:log_debug
,rid::log_warn
to send messages to be logged in Dartrid::error
,rid::severe
to report errors to dartThe log messages can then be handled on the Dart/Flutter side to output them via print/debugPrint indicating that they come from Rust. This will make debugging rid apps much easier.
For now I'll implement an example of doing this in the next example app and will think about how/which parts can be added to rid proper to make using the message channel for logs easier.
The error messages are meant to be handled as follows:
message + details
to console and on Flutter show a Snackbar with themessage
message + details
to console and on Flutter show a banner on top of the screen viashowMaterialBanner
with themessage
These as well will be added to the example and I will see if an API to handle this as described can be included with Rid in the future.
rid class
With these changes I introduced a
Rid
class accessible viarid
on the Dart side. It provides access to therid.messageChannel
and will include access to more features coming in the future. I'm also considering adding the config properties likeRID_LOG_DEBUG
and such to this class.