Hi, does anyone use typesense with flutter? Im try...
# community-help
r
Hi, does anyone use typesense with flutter? Im trying to map a typesense document into a custom dart object like the following:
Copy code
final hits = (a['hits'] as List)
                      .cast<Map>()
                      .map((e) => UserSearchable(name: e['document'] as Map['name'] as String, id:e['document'] as Map['id'] as String, imageUrls: e['document'] as Map['imageUrls'] as List<String>))
                      .toList();
but it throws an error saying "The argument type 'Map<dynamic, dynamic>' can't be assigned to the parameter type 'String'". Anyone deal with something similar?
j
CC: @Harpreet Sangar
h
Hi @Rude Buster Is this causing the issue?
Copy code
name: e['document'] as Map['name'] as String
if so, can you try
Copy code
name: (e['document'] as Map)['name'] as String
Otherwise doing
Copy code
e['document']['name"]
should suffice
r
Yup, looks like that worked! Thank you!