getAppName static method

Future<String> getAppName()

NOTE: In our testing app, iOS will not return a name. This is because Flutter has an open issue with app names for iOS (which can be resolved manually). Our SDK is expected to deliver correct app names for publishers, if they solved their own name issue.

Source: https://github.com/flutter/flutter/issues/43877

Implementation

static Future<String> getAppName() async {
  if (TextUtils.isEmptyOrNull(_appName)) {
    TBLPackageInfo packageInfo = await TBLPackageInfo.getAllPackageInfo();
    if (packageInfo.appName.isEmpty) {
      TBLLogger.log(
          'ApplicationDescriptor | getAppName() | packageInfo is null.');
      return "";
    }
    _appName = packageInfo.appName;

    try {
      _appName = HtmlEscape().convert(_appName);
    } catch (e) {
      TBLLogger.logException(
          'ApplicationDescriptor | HtmlEscape.convert() exception: ${e.toString()}');
    }
  }

  return _appName;
}