<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Masatoshi Tsushima</title>
    <description>The latest articles on DEV Community by Masatoshi Tsushima (@utisam).</description>
    <link>https://dev.to/utisam</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1103966%2F87331175-27e6-4b04-b49e-900bbdb68987.png</url>
      <title>DEV Community: Masatoshi Tsushima</title>
      <link>https://dev.to/utisam</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/utisam"/>
    <language>en</language>
    <item>
      <title>Monitoring Performance of Drift in Flutter App with Sentry</title>
      <dc:creator>Masatoshi Tsushima</dc:creator>
      <pubDate>Mon, 26 Jun 2023 05:00:42 +0000</pubDate>
      <link>https://dev.to/utisam/monitoring-performance-of-drift-in-flutter-app-with-sentry-2jhb</link>
      <guid>https://dev.to/utisam/monitoring-performance-of-drift-in-flutter-app-with-sentry-2jhb</guid>
      <description>&lt;h2&gt;
  
  
  Drift
&lt;/h2&gt;

&lt;p&gt;&lt;code&gt;sqflite&lt;/code&gt; is introduced in &lt;a href="https://docs.flutter.dev/cookbook/persistence"&gt;the official cookbook&lt;/a&gt; to persist data.　But &lt;a href="https://drift.simonbinder.eu/"&gt;Drift (a.k.a moor)&lt;/a&gt; is another strong option to use SQLite in Flutter app.&lt;/p&gt;

&lt;h2&gt;
  
  
  Sentry
&lt;/h2&gt;

&lt;p&gt;Sentry is well known as error tracking tool, but also you can use to monitor performance. Competitors are Datadog/New Relic/Firebase Crashlytics.&lt;/p&gt;

&lt;h2&gt;
  
  
  Drift &amp;amp; Sentry
&lt;/h2&gt;

&lt;p&gt;Unfortunately, however, there is no library available for linking Sentry with Drift. I made it with reference to &lt;a href="https://pub.dev/packages/sentry_sqflite"&gt;sentry_sqflite&lt;/a&gt;.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;pub.dev: &lt;a href="https://pub.dev/packages/drift_sentry"&gt;https://pub.dev/packages/drift_sentry&lt;/a&gt;
&lt;/li&gt;
&lt;li&gt;GitHub: &lt;a href="https://github.com/utisam/drift_sentry"&gt;https://github.com/utisam/drift_sentry&lt;/a&gt;
&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Usage
&lt;/h3&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight dart"&gt;&lt;code&gt;&lt;span class="n"&gt;LazyDatabase&lt;/span&gt; &lt;span class="nf"&gt;_openConnection&lt;/span&gt;&lt;span class="p"&gt;()&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
  &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;LazyDatabase&lt;/span&gt;&lt;span class="p"&gt;(()&lt;/span&gt; &lt;span class="kd"&gt;async&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;dbFolder&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="k"&gt;await&lt;/span&gt; &lt;span class="n"&gt;getApplicationDocumentsDirectory&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
    &lt;span class="kd"&gt;final&lt;/span&gt; &lt;span class="n"&gt;file&lt;/span&gt; &lt;span class="o"&gt;=&lt;/span&gt; &lt;span class="n"&gt;File&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;p&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;join&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;dbFolder&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;path&lt;/span&gt;&lt;span class="p"&gt;,&lt;/span&gt; &lt;span class="s"&gt;'db.sqlite'&lt;/span&gt;&lt;span class="p"&gt;));&lt;/span&gt;
    &lt;span class="c1"&gt;// Use .addSentry() to wrap QueryExecutor&lt;/span&gt;
    &lt;span class="k"&gt;return&lt;/span&gt; &lt;span class="n"&gt;NativeDatabase&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;createInBackground&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="n"&gt;file&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="o"&gt;.&lt;/span&gt;&lt;span class="na"&gt;addSentry&lt;/span&gt;&lt;span class="p"&gt;();&lt;/span&gt;
  &lt;span class="p"&gt;});&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Finally, it is the measurement result:&lt;/p&gt;

&lt;p&gt;&lt;a href="https://res.cloudinary.com/practicaldev/image/fetch/s--qAyHKNjm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/91r8ufkkh86rb8fghxr5.png" class="article-body-image-wrapper"&gt;&lt;img src="https://res.cloudinary.com/practicaldev/image/fetch/s--qAyHKNjm--/c_limit%2Cf_auto%2Cfl_progressive%2Cq_auto%2Cw_800/https://dev-to-uploads.s3.amazonaws.com/uploads/articles/91r8ufkkh86rb8fghxr5.png" alt="Image description" width="707" height="597"&gt;&lt;/a&gt;&lt;/p&gt;

</description>
      <category>flutter</category>
      <category>mobile</category>
      <category>monitoring</category>
      <category>database</category>
    </item>
  </channel>
</rss>
