Sobes.tech
Junior — Middle

Have you had experience developing or interacting with native code in Flutter projects?

sobes.tech AI

Answer from AI

Yes, in Flutter, you can interact with native code through platform channels. This allows calling Java/Kotlin code for Android and Objective-C/Swift for iOS from Flutter when access to platform-specific features is needed.

Example: if you need to get device battery data that is not available in standard Flutter plugins, you can write native code and call it from Flutter via MethodChannel.

// Flutter side
static const platform = MethodChannel('samples.flutter.dev/battery');

Future<int> getBatteryLevel() async {
  final int batteryLevel = await platform.invokeMethod('getBatteryLevel');
  return batteryLevel;
}

On the Android side, a corresponding method is written to handle the call and return data.

Have you had experience developing or interacting… - sobes.tech