GSync class
Lazy GSync
- Require Google authorization token with scope 'https://www.googleapis.com/auth/drive.appdata'
- Sync content is String type
- Sync single file content in Google Drive
appData
space
Constructors
Properties
- auto ↔ bool
-
auto control periodic run of sync with interval = autoSyncIntervalMin
getter/setter pair
- autoSyncIntervalMin ↔ int
-
Auto sync interval
getter/setter pair
- content → String
-
Return result of getLocalContent, content to be saved to Google Drive
no setter
- enable ↔ bool
-
- true : allow sync all functions
- false(default) : disable sync all functions
getter/setter pair -
error
→ ValueNotifier<
bool> -
true
on sync error.false
on sync success(no error).final - filename → String
-
Return result of getFilename, filename used when saving to Google Drive
no setter
- getFilename ↔ String Function()?
-
A callback, should return a filename in String to be used remotely
getter/setter pair
- getLocalContent ↔ String Function()?
-
A callback, should return local content in String to be saved remotely
getter/setter pair
- getLocalSaveTime ↔ DateTime Function()?
-
A callback, should return last local save time
getter/setter pair
- hashCode → int
-
The hash code for this object.
no setterinherited
- lastSync → DateTime
-
Return
DateTime
of last sync() successful run.no setter - localSaveNotifier ↔ Listenable?
-
- Trigger sync when
v
send notification- Start listening if not null
- Stop listening if null
getter/setter pair - Trigger sync when
- localSaveTime → DateTime
-
Return result of getLocalSaveTime, last save time of content/data saved locally
no setter
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
- setLocalContent ↔ void Function(String, DateTime?)?
-
A callback, trigger when content is downloaded from remote
getter/setter pair
-
syncing
→ ValueNotifier<
bool> -
true
when sync startfalse
when sync stopfinal - token ↔ String
-
Google authorization token with 'https://www.googleapis.com/auth/drive.appdata' scope.
getter/setter pair
Methods
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
sync(
{bool forceDownload = false, bool forceUpload = false, bool ignoreError = false}) → Future -
Initiate download from remote if getLocalSaveTime < google drive save time
Initiate upload to remote if getLocalSaveTime > google drive save time
Auto skip or no real action (no throw) if
- enable is
false
, except whenforceDownload
orforceUpload
istrue
- error.value is
true
, exceptignoreError
set totrue
forceDownload
and remote file does not exist- syncing.value is
true
, syncing is in progress - local(from getLocalSaveTime) and remote save time are same
syncing.value : will be set to
true
at beginning and tofalse
when done.error.value : will be set to
true
on error. Reset(tofalse
) on successful sync.forceDownload
: when set totrue
, will initiate download from remote regardless of save time on both sidesforceUpload
: when set totrue
, will initiate upload to remote regardless of save time on both sidesThrow if
- Both
forceDownload
andforceUpload
aretrue
. - token is empty.
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited