buildAppleAppSiteAssociation method

Map<String, dynamic> buildAppleAppSiteAssociation(
  1. String teamId,
  2. String bundleId,
  3. List<String> paths
)

Build the apple-app-site-association JSON map for iOS Universal Links.

Emits exactly one details entry in Apple's modern appIDs + components shape (TN3155). The legacy appID + paths shape and the apps key are never emitted, because Apple's guidance warns that mixing the two schemas may produce unexpected behaviour for universal links.

@param teamId Apple Developer Team ID. @param bundleId iOS app bundle identifier. @param paths Universal Link path patterns to register (e.g. ['/*']), passed through unchanged into components. @return A Map<String, dynamic> ready for JSON serialisation.

Implementation

Map<String, dynamic> buildAppleAppSiteAssociation(
  String teamId,
  String bundleId,
  List<String> paths,
) {
  return {
    'applinks': {
      'details': [
        {
          'appIDs': ['$teamId.$bundleId'],
          'components': paths.map((path) {
            return {
              '/': path,
              'comment': 'Matches any URL whose path matches $path',
            };
          }).toList(),
        },
      ],
    },
  };
}