title: Storing a List in a Blob with sqflite
body: <p>I am looking for an example of storing a generic Dart object (typically a <code>List&lt;MyObject&gt;</code>) in a Blob column with sqflite (and retrieving it back please) assuming it will store it as binary data.</p>
  
  <p>MyObject is an object used by my application, its content is not important here as I am looking for a generic/universal method. </p>
  
  <p>Could anybody be kind enough to provide a snippet? </p>
  
  <p>Documentation on this subject is rare with Dart. Closest I could find would include marshaling the object as Uint8List <a href="https://code-examples.net/fr/docs/dart~2/dart-convert/jsonutf8encoder/convert" rel="nofollow noreferrer">something like this</a> or <a href="https://stackoverflow.com/questions/28777712/how-to-convert-a-dart-html-client-web-socket-response-from-blob-to-uint8list">something like that</a> but I could not really understand/apply them.</p>
  
  <p>I have found <a href="https://stackoverflow.com/questions/57514027/update-how-to-store-liststring-data-type-in-sqflite-sqflite-error-database">this similar issue</a>, where the developer ends up converting his lists as a string... We really cannot do better (ie more efficient) ? </p>
  
  <p>Many thanks for your help.</p>
  
  <p>Patrick</p>