title: How to use Reorderable with Sqflite list?
body: <p>I am saving a list of profiles in sqflite and I am trying to make my list reorderable. In my Helper class I have these methods: </p>
  
  <pre><code> static Future insertProfile(Map&lt;String, dynamic&gt; profile) async {
      await db.insert('Profiles', profile);
    }
  
    static Future deleteProfile(int id) async {
      await db.delete('Profiles', where: 'id = ?', whereArgs: [id]);
    }
  
    static Future updateProfile(Map&lt;String, dynamic&gt; profile) async {
      await db.update('Profiles', profile,
          where: 'id = ?', whereArgs: [profile['id']]);
    }
  </code></pre>
  
  <p>My profiles list looks like this:</p>
  
  <pre><code>@override
    Widget build(BuildContext context) {
      return Scaffold(
        appBar: AppBar(title: Text('Profiles')),
        body: FutureBuilder(
          future: ProfileProvider.getProfileList(),
          builder: (context, snapshot) {
            if (snapshot.connectionState == ConnectionState.done) {
              var profiles = snapshot.data;
              return snapshot.data == null
                  ? Container()
                  : ReorderableListView(
                      children: List.generate(
                        profiles.length,
                        (index) {
                          return Dismissible(
                            key: ValueKey("value$index"),
                            background: slideBackground(),
                            onDismissed: (direction) {
                              ProfileProvider.deleteProfile(
                                  profiles[index]['id']);
                              showSnackBar(
                                  context, profiles[index]['title'], [index]);
                            },
  </code></pre>
  
  <p>I am trying to replicate this type of function, but with Sqlite:</p>
  
  <pre><code>void _onReorder(int oldIndex, int newIndex) {
    setState(
      () {
        if (newIndex &gt; oldIndex) {
          newIndex -= 1;
        }
        final String item = profiles.removeAt(oldIndex);
        profiles.insert(newIndex, item);
      },
    );
  }
  </code></pre>
  
  <p>So far I have managed deleting successfully:</p>
  
  <pre><code>onReorder: (int oldIndex, int newIndex) {
                        if (newIndex &gt; oldIndex) {
                          newIndex -= 1;
                        }
                        setState(
                          () {
                            ProfileProvider.deleteProfile(profiles[oldIndex]['id']);
                          },
                        );
                      },
  </code></pre>
  
  <p>The problem is I can't find how to reinsert the same profile at the new index. </p>
  
  <p>I tried many things but the latest is this:</p>
  
  <pre><code>                          var item = profiles[oldId]['id'];
                            ProfileProvider.deleteProfile(profiles[oldId]['id']);
                            ProfileProvider.insertProfile(item);
  </code></pre>
  
  <p>However, I get this error message :</p>
  
  <pre><code>type 'int' is not a subtype of type 'Map&lt;String, dynamic&gt;'
  </code></pre>
  
  <p>Any ideas?</p>