SkygearIO / features

Feature Tracking Repo for Skygear
Apache License 2.0
3 stars 12 forks source link

Flutter client #205

Open ghost opened 6 years ago

ghost commented 6 years ago

Description

Flutter is agnostic and so runs on Android and iOS and is getting popular for these reasons.

Scenario

All of your Server API's can be exposed.

If you want you can also run golang code on the mobiles behind the flutter code. I do this where I want logic to be shared between the client and server or if I want offline storage using the same db on the server or client. Very DRY.

Portal Design

None I think except for the data source. All networking code I tend to write in golang to run on the client and server. Again DRY.

API Design

Remove this section if the feature have no API

Open Questions

Put a list of open questions here before a complete design / specification is decided

Related Issues

chpapa commented 6 years ago

Very interesting idea @gedw99 . Would you be interested to develop it on a bounty basis? :)

ghost commented 6 years ago

How does that work ?

I had a sniff around the code.

  1. where is the client side DB ? I see your using postgres server side, but how do you run the client side DB. I use boltdb and badger to have a DB on both sides that can sync. I guess your have not designed for offline use yet ? In terms of record level sync there are 2 or 3 architectural options depending on needs.

  2. Keys and auth on the client side. I did not see any proper key store code on the client code.

  3. Flutter wrapper. I had a look at the ios and android code. You have 2 options:

  4. wrap each with flutter which will mean a fair bit or refactoring. if you also want to keep your ios and android sdk's stable it will be very delicate work and painful to test.

  5. dont use any of it and just use golang for all 3, with a ios, android and flutter wrapper. Thats what i do anyway.

chpapa commented 6 years ago

Hope these can help give some pointers:

where is the client side DB ? I see your using postgres server side, but how do you run the client side DB. I use boltdb and badger to have a DB on both sides that can sync. I guess your have not designed for offline use yet ? In terms of record level sync there are 2 or 3 architectural options depending on needs.

Skygear Client SDK don't have a lot of offline feature yet. Currently I think other SDK use realm for offline storage.

Keys and auth on the client side. I did not see any proper key store code on the client code.

It should be JWT token stored on client side.

Flutter wrapper. I had a look at the ios and android code. You have 2 options:

I think have a golang SDK might make sense

tonyhhyip commented 6 years ago

@chpapa I would like to implement the client of flutter There are two option for implementation

  1. Calling the existing client of iOS and Android using platform channel
  2. Implement directly with Dart

Another issue require to discuss is about the packaging issue, also there are two options

  1. Put every feature in a standalone package
  2. Bundle everything into one package

Here is the Firebase on Flutter: https://github.com/flutter/plugins/blob/master/FlutterFire.md

chpapa commented 6 years ago

For the first question, I don't have specific opinions. Gut feeling is it would be easier to have a native Dart implementation, but if using native SDK would make the MVP or 1st version I won't be against it.

For 2nd question, on other platform, we tends to have each feature in it own modules, and have a meta module to import once for all packages, so users can either use single feature, or import all at once.