Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
deb5e40f
Unverified
Commit
deb5e40f
authored
Feb 03, 2021
by
Jonah Williams
Committed by
GitHub
Feb 03, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
[flutter_tools] handle null package (#75336)
parent
3b884aa6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
1 deletion
+15
-1
language_version.dart
packages/flutter_tools/lib/src/dart/language_version.dart
+1
-1
language_version_test.dart
..._tools/test/general.shard/dart/language_version_test.dart
+14
-0
No files found.
packages/flutter_tools/lib/src/dart/language_version.dart
View file @
deb5e40f
...
...
@@ -86,7 +86,7 @@ LanguageVersion determineLanguageVersion(File file, Package package) {
// If the language version cannot be found, use the package version.
if
(
package
!=
null
)
{
return
package
.
languageVersion
;
return
package
.
languageVersion
??
nullSafeVersion
;
}
// Default to 2.12
return
nullSafeVersion
;
...
...
packages/flutter_tools/test/general.shard/dart/language_version_test.dart
View file @
deb5e40f
...
...
@@ -254,6 +254,20 @@ library funstuff;
expect
(
determineLanguageVersion
(
file
,
package
),
LanguageVersion
(
2
,
7
));
});
testWithoutContext
(
'defaults to null safe version if package lookup returns null'
,
()
{
final
FileSystem
fileSystem
=
MemoryFileSystem
.
test
();
final
File
file
=
fileSystem
.
file
(
'example.dart'
)
..
writeAsStringSync
(
'''
// Some license
'''
);
final
Package
package
=
Package
(
'foo'
,
Uri
.
parse
(
'file://foo/'
),
languageVersion:
null
,
);
expect
(
determineLanguageVersion
(
file
,
package
),
LanguageVersion
(
2
,
12
));
});
testWithoutContext
(
'Returns null safe error if reading the file throws a FileSystemException'
,
()
{
final
Package
package
=
Package
(
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment