getTimeTravelData static method
Get time-travel debugging data (for ReduxStore)
Implementation
static Map<String, dynamic>? getTimeTravelData(String storeId) {
if (!_enabled) {
return {'error': 'DevTools not enabled'};
}
// Try to find ReduxStore by ID
try {
final reduxStore = _getStoreById(storeId);
if (reduxStore != null && reduxStore is ReduxStore) {
return {
'currentState': _serializeValue(reduxStore.value),
'actionHistory': reduxStore.actionHistory.map((a) => {
'type': a.type,
'payload': a.payload,
'timestamp': DateTime.now().toIso8601String(),
}).toList(),
'canTimeTravel': true,
'actionCount': reduxStore.actionHistory.length,
};
}
} catch (e) {
return {'error': e.toString()};
}
return {'error': 'ReduxStore not found with id: $storeId'};
}