Skip to content

Instantly share code, notes, and snippets.

@mehmetf
Created October 2, 2018 18:00
Show Gist options
  • Save mehmetf/2d78b41deb61e814f20f7ba0a26337e5 to your computer and use it in GitHub Desktop.
Save mehmetf/2d78b41deb61e814f20f7ba0a26337e5 to your computer and use it in GitHub Desktop.
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