Skip to content

Commit 976bd6a

Browse files
authored
Fixes null error when parsing universal link settings (#9581)
fixes #8972 it is possible the tool can't get team id from the xcode project if the xcode developer team is not properly set up. In that case it will be null in the universal link setting's json. This Pr handles that cases ![build.yaml badge] If you need help, consider asking for help on [Discord]. [build.yaml badge]: https://github.com/flutter/devtools/actions/workflows/build.yaml/badge.svg
1 parent 0858d72 commit 976bd6a

File tree

3 files changed

+54
-2
lines changed

3 files changed

+54
-2
lines changed

packages/devtools_app/release_notes/NEXT_RELEASE_NOTES.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ TODO: Remove this section if there are not any general updates.
5555
- Added more informative dialog if Deep Links tool is unable to find build
5656
options for the iOS or Android app. -
5757
[#9571](https://github.com/flutter/devtools/pull/9571)
58+
- Fixed null error when parsing universal link settings -
59+
[#9581](https://github.com/flutter/devtools/pull/9581)
5860

5961
## VS Code Sidebar updates
6062

packages/devtools_shared/lib/src/deeplink/universal_link_settings.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,10 @@ extension type const UniversalLinkSettings._(Map<String, Object?> _json) {
2121
});
2222

2323
/// The bundle identifier of the iOS build of this Flutter project.
24-
String get bundleIdentifier => _json[_kBundleIdentifierKey] as String;
24+
String? get bundleIdentifier => _json[_kBundleIdentifierKey] as String?;
2525

2626
/// The team identifier of the iOS build of this Flutter project.
27-
String get teamIdentifier => _json[_kTeamIdentifierKey] as String;
27+
String? get teamIdentifier => _json[_kTeamIdentifierKey] as String?;
2828

2929
/// The associated domains of the iOS build of this Flutter project.
3030
List<String> get associatedDomains =>
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Copyright 2025 The Flutter Authors
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file or at https://developers.google.com/open-source/licenses/bsd.
4+
5+
import 'package:devtools_shared/src/deeplink/universal_link_settings.dart';
6+
import 'package:test/test.dart';
7+
8+
void main() {
9+
group('UniversalLinkSettings', () {
10+
test('parses json correctly', () {
11+
const json = '''
12+
{
13+
"bundleIdentifier": "com.example.app",
14+
"teamIdentifier": "TEAMID",
15+
"associatedDomains": ["applinks:example.com"]
16+
}
17+
''';
18+
final settings = UniversalLinkSettings.fromJson(json);
19+
expect(settings.bundleIdentifier, 'com.example.app');
20+
expect(settings.teamIdentifier, 'TEAMID');
21+
expect(settings.associatedDomains, ['applinks:example.com']);
22+
});
23+
24+
test('handles null bundleIdentifier', () {
25+
const json = '''
26+
{
27+
"teamIdentifier": "TEAMID",
28+
"associatedDomains": ["applinks:example.com"]
29+
}
30+
''';
31+
final settings = UniversalLinkSettings.fromJson(json);
32+
expect(settings.bundleIdentifier, isNull);
33+
expect(settings.teamIdentifier, 'TEAMID');
34+
expect(settings.associatedDomains, ['applinks:example.com']);
35+
});
36+
37+
test('handles null teamIdentifier', () {
38+
const json = '''
39+
{
40+
"bundleIdentifier": "com.example.app",
41+
"associatedDomains": ["applinks:example.com"]
42+
}
43+
''';
44+
final settings = UniversalLinkSettings.fromJson(json);
45+
expect(settings.bundleIdentifier, 'com.example.app');
46+
expect(settings.teamIdentifier, isNull);
47+
expect(settings.associatedDomains, ['applinks:example.com']);
48+
});
49+
});
50+
}

0 commit comments

Comments
 (0)