Reputation: 3620
I'm currently migrating a native Android music app to Flutter. This app relies on:
Service
where the player isI try to migrate as much code as possible from native code to Flutter, since the app will also be available on iOS.
That said, the Service
part (and its iOS equivalent) will be written using native code, since there is no equivalent in Flutter, as far as I know. Also, the audio player is already written (I won't use another one) since it's for a very specific use (it's written in C++ using OpenSL ES)
That apps makes a heavy use of the SharedPreferences and the database, inside and outside the Service
.
So my question is: since a part of the app will still be written in native code, that will need to manipulate data in the SharedPreferences and in the database, what is the best approach: should I create and manipulate the SharedPreferences and the database using native code (Android and iOS), or using Flutter?
Thanks.
Upvotes: 0
Views: 870
Reputation: 211
In your case you don't need any native code at all.
You can use dart/flutter packages.
To use shared Preference you can add the package to your app and it will work out off the box for both android and IOS without any other configuration
link :
https://pub.dev/packages/shared_preferences
For the DB section there are wide number of choices if you want a SQL DB you can use sqflite (not as smart as ROOM but it will do the job).
Link :
https://pub.dev/packages/sqflite
If you want to switch to Nosql DB i'll recommend Hive : take a look here :
Finally to the service it depends on your need and your app complexity but for a music app i think the audiopLayers Package will do it : take look here :
https://pub.dev/packages/audioplayers
Note that: Some packages may need some configuration to work something like edit androidManifest.xml or info.plist .
Upvotes: 1