Created
October 2, 2018 18:00
-
-
Save mehmetf/2d78b41deb61e814f20f7ba0a26337e5 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class StoragePlugin { | |
Future<String> getString(String key) async { | |
if (Platform.isIos) { | |
return await callMethodChannel('fetchValue', {'id': base64encode(key)}); | |
} else if (Platform.isAndroid) { | |
return await callMethodChannel('fetchValue', {'id': key}); | |
} | |
} | |
Future<void> setString(String key, String value) async { | |
if (Platform.isIos) { | |
await callMethodChannel('setValue', {'id': base64encode(key), 'value': value}); | |
} else if (Platform.isAndroid) { | |
await callMethodChannel('setValue', {'id': key, 'value': value}); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment