saveData<T> method

  1. @override
Future<bool> saveData<T>(
  1. String key,
  2. T? value
)
override

Implementation

@override
Future<bool> saveData<T>(String key, T? value) async {
  if (value != null && value is! String && value is! int && value is! double && value is! bool) {
    throw ArgumentError(
      'Unsupported value type ${value.runtimeType}. '
      'Supported types: String, int, double, bool.',
    );
  }
  final result = await methodChannel.invokeMethod<bool>('saveData', {
    'key': key,
    'value': value,
  });
  return result ?? false;
}