Describe the bug
When saving a transaction with an empty description in TransactionEntryPage, the application crashes with an unhandled UnexpectedValueError.
Steps to Reproduce
- Open the new transaction screen (
/transaction/new).
- Select an amount and choose a Category (Envelope).
- Leave the Description input blank.
- Tap Save Transaction.
- The application throws
UnexpectedValueError on StringSingleLine.getOrCrash() during model conversion / entity instantiation and crashes.
Expected Behavior
- The app should not crash.
- If the description is left blank, the system should automatically generate a contextual description based on the transaction type and category name (e.g.,
Spending for Dining, Income from Salary, Investment in Stocks).
- Users should be able to quickly log transactions without being strictly forced to type a custom description every time.
Proposed Fix
- In
TransactionCubit.submitTransaction(), evaluate if state.description.trim().isEmpty.
- Dynamically build a fallback description:
- Expense:
Spending for <Category>
- Income:
Income from <Category>
- Investment:
Investment in <Category>
- Transfer:
Transfer for <Category>
- Fallback:
Transaction
- Add unit tests in
transaction_cubit_test.dart to ensure empty and whitespace descriptions never crash and correctly generate contextual defaults.
Describe the bug
When saving a transaction with an empty description in
TransactionEntryPage, the application crashes with an unhandledUnexpectedValueError.Steps to Reproduce
/transaction/new).UnexpectedValueErroronStringSingleLine.getOrCrash()during model conversion / entity instantiation and crashes.Expected Behavior
Spending for Dining,Income from Salary,Investment in Stocks).Proposed Fix
TransactionCubit.submitTransaction(), evaluate ifstate.description.trim().isEmpty.Spending for <Category>Income from <Category>Investment in <Category>Transfer for <Category>Transactiontransaction_cubit_test.dartto ensure empty and whitespace descriptions never crash and correctly generate contextual defaults.