import 'package:flutter/services.dart'; class ServicioVersionApp { static const _channel = MethodChannel('farolero/app_info'); static Future obtenerVersion() async { final Map? info; try { info = await _channel.invokeMapMethod( 'getAppVersion', ); } on PlatformException { return '-'; } on MissingPluginException { return '-'; } final versionName = info?['versionName']?.toString(); final versionCode = info?['versionCode']?.toString(); if (versionName == null || versionName.isEmpty) { return '-'; } if (versionCode == null || versionCode.isEmpty) { return versionName; } return '$versionName+$versionCode'; } }