get<T> method

  1. @override
Future<T?> get<T>(
  1. String key
)
override

Using to get settings value by key T is type of value base on element types return T or null

Implementation

@override
Future<T?> get<T>(String key) async {
  try {
    final response = await methodChannel
        .invokeMethod<T>('getSettingsBundle', {'key': key});
    return response;
  } on PlatformException catch (e) {
    if (e.code == "-404") {
      throw Exception("Key $key is not registered in Setting.bundle");
    }
  } catch (e) {
    rethrow;
  }
  return null;
}