Fluuter - PlatformException

PlatformException: This error occurs when a platform-specific operation fails.

Example:

import 'package:flutter/services.dart';


void main() {

  const platform = MethodChannel('example');

  try {

    final result = await platform.invokeMethod('method');

  } on PlatformException catch (e) {

    print('Platform Exception: ${e.message}');

  }

}

Solution: Check that the operation is supported on the current platform or if there is a problem with the platform-specific code.

Comments