Dart cannot natively handle errors, rather 'fails unexpectedly' when C throws any error.
Importance: Flutter must capture errors to alert the user to make changes, so C errors must be converted into Dart
Approach 1: ErrorTranslator 🏆
C++ object that is always passed by reference for every function.
It should capture + handle various (if not all) error types.
From Dart, we would try to access data stored in C Memory to retrieve the current "status" of our function call / stack.
Pros:
Follows same pattern as Afhe, passed by reference with attributes
Cons:
Modifies every existing function
Approach 2: Specialized return types
For objects, create sub-routine .status() returns error message if any
For int or string return types, use -1
Cons:
Non-objects are ambiguous, less control for error messages
Dart cannot natively handle errors, rather 'fails unexpectedly' when C throws any error.
Importance: Flutter must capture errors to alert the user to make changes, so C errors must be converted into Dart
Approach 1:
ErrorTranslator
🏆 C++ object that is always passed by reference for every function. It should capture + handle various (if not all) error types. From Dart, we would try to access data stored in C Memory to retrieve the current "status" of our function call / stack.Pros:
Cons:
Approach 2: Specialized return types For objects, create sub-routine
.status()
returns error message if any Forint
orstring
return types, use-1
Cons: