anchor.diff:        logger.printError('Please check ${manifest.path} for errors.');
         return null;
       }
  -    final String packageId = manifests.first.getAttribute('package');
  -
  -    String launchActivity;
  +    final String? packageId = manifests.first.getAttribute('package');
  +
  +    String? launchActivity;
       for (final XmlElement activity in document.findAllElements('activity')) {
  -      final String enabled = activity.getAttribute('android:enabled');
  +      final String? enabled = activity.getAttribute('android:enabled');
         if (enabled != null && enabled == 'false') {
           continue;
         }
   
         for (final XmlElement element in activity.findElements('intent-filter')) {
  -        String actionName = '';
  -        String categoryName = '';
  +        String? actionName = '';
  +        String? categoryName = '';
           for (final XmlNode node in element.children) {
             if (node is! XmlElement) {
               continue;
             }
  -          final XmlElement xmlElement = node as XmlElement;
  -          final String name = xmlElement.getAttribute('android:name');
  +          final String? name = node.getAttribute('android:name');
             if (name == 'android.intent.action.MAIN') {
               actionName = name;
             } else if (name == 'android.intent.category.LAUNCHER') {
               categoryName = name;
             }
           }
  -        if (actionName.isNotEmpty && categoryName.isNotEmpty) {
  -          final String activityName = activity.getAttribute('android:name');
  +        if (actionName != null && categoryName != null && actionName.isNotEmpty && categoryName.isNotEmpty) {
  +          final String? activityName = activity.getAttribute('android:name');
             launchActivity = '$packageId/$activityName';
             break;
           }
  
positive.code:   /// Creates a new AndroidApk from an existing APK.
    ///
    /// Returns `null` if the APK was invalid or any required tooling was missing.
    factory AndroidApk.fromApk(File apk, {
      @required AndroidSdk androidSdk,
      @required ProcessManager processManager,
      @required UserMessages userMessages,
      @required Logger logger,
      @required ProcessUtils processUtils,
    }) {
      final String aaptPath = androidSdk?.latestVersion?.aaptPath;
      if (aaptPath == null || !processManager.canRun(aaptPath)) {
        logger.printError(userMessages.aaptNotFound);
        return null;
  
negative.code:     return _Attribute._(keyVal[0], keyVal[1], parent, line.length - line.trimLeft().length);
    }
  
    final String? key;
    final String? value;
  }
  
  class ApkManifestData {
    ApkManifestData._(this._data);
  
    static bool _isAttributeWithValuePresent(
        _Element baseElement, String childElement, String attributeName, String attributeValue) {
      final Iterable<_Element> allElements = baseElement.allElements(childElement);
      for (final _Element oneElement in allElements) {
        final String? elementAttributeValue = oneElement
            .firstAttribute(attributeName)
            ?.value;
        if (elementAttributeValue != null &&
            elementAttributeValue.startsWith(attributeValue)) {
  