fix: Make QueuedToDeviceEvent store content as String OR Map

Temporary fix to stay compatible to Moor AND a key value store
This commit is contained in:
Christian Pauly 2021-06-01 12:56:43 +02:00
parent d0f67f914a
commit 73db010db4
1 changed files with 6 additions and 1 deletions

View File

@ -15,6 +15,8 @@
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import 'dart:convert';
class QueuedToDeviceEvent {
final int id;
final String type;
@ -28,7 +30,10 @@ class QueuedToDeviceEvent {
id: json['id'],
type: json['type'],
txnId: json['txn_id'],
content: json['content'],
// Temporary fix to stay compatible to Moor AND a key value store
content: json['content'] is String
? jsonDecode(json['content'])
: json['content'],
);
Map<String, dynamic> toJson() => {