Skip to content

Instantly share code, notes, and snippets.

@haashem
Last active May 21, 2022 06:46
Show Gist options
  • Save haashem/c4703b79bcee0af22fc3a3cee13bc867 to your computer and use it in GitHub Desktop.
Save haashem/c4703b79bcee0af22fc3a3cee13bc867 to your computer and use it in GitHub Desktop.
NaurtIOS
import 'package:flutter/foundation.dart';
import 'package:flutter/services.dart';
import 'package:naurt_platfrom_interface/naurt_platform_interface.dart';
/// An implementation of [NaurtIOS] that uses method channels.
class NaurtIOS extends NaurtPlatform {
/// The method channel used to interact with the native platform.
@visibleForTesting
final methodChannel = const MethodChannel('com.naurt.ios');
/// Registers this class as the default instance of [NaurtPlatform].
static void registerWith() {
NaurtPlatform.instance = NaurtIos._privateConstructor();
}
NaurtIos._privateConstructor();
static final NaurtIos shared = NaurtIos._privateConstructor();
@override
Future<bool> initialize(
{required String apiKey, required int precision}) async {
final bool isInitialised = await methodChannel.invokeMethod('initialize', {
'apiKey': apiKey,
'precision': precision,
});
return isInitialised;
}
@override
Future<bool> isRunning() async {
final bool isRunning = await methodChannel.invokeMethod('isRunning');
return isRunning;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment