Skip to content
Prev Previous commit
Next Next commit
Remove force-unwraps that are no longer necessary due to improved inf…
…erence
  • Loading branch information
stuartmorgan-g committed May 14, 2024
commit 20dd0d0027c9f5a36dc041b60a6b22d3ee0e8bb1
2 changes: 1 addition & 1 deletion packages/flutter_migrate/lib/src/base/context.dart
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class AppContext {
T? get<T>() {
dynamic value = _generateIfNecessary(T, _overrides);
if (value == null && _parent != null) {
value = _parent!.get<T>();
value = _parent.get<T>();
}
return _unboxNull(value ?? _generateIfNecessary(T, _fallbacks)) as T?;
}
Expand Down
28 changes: 14 additions & 14 deletions packages/flutter_migrate/test/src/io.dart
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,31 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.createDirectory(path);
}
return _fileSystemDelegate!.directory(path);
return _fileSystemDelegate.directory(path);
}

@override
io.File createFile(String path) {
if (_fileSystemDelegate == null) {
return super.createFile(path);
}
return _fileSystemDelegate!.file(path);
return _fileSystemDelegate.file(path);
}

@override
io.Link createLink(String path) {
if (_fileSystemDelegate == null) {
return super.createLink(path);
}
return _fileSystemDelegate!.link(path);
return _fileSystemDelegate.link(path);
}

@override
Stream<FileSystemEvent> fsWatch(String path, int events, bool recursive) {
if (_fileSystemDelegate == null) {
return super.fsWatch(path, events, recursive);
}
return _fileSystemDelegate!
return _fileSystemDelegate
.file(path)
.watch(events: events, recursive: recursive);
}
Expand All @@ -61,78 +61,78 @@ class FlutterIOOverrides extends io.IOOverrides {
if (_fileSystemDelegate == null) {
return super.fsWatchIsSupported();
}
return _fileSystemDelegate!.isWatchSupported;
return _fileSystemDelegate.isWatchSupported;
}

@override
Future<FileSystemEntityType> fseGetType(String path, bool followLinks) {
if (_fileSystemDelegate == null) {
return super.fseGetType(path, followLinks);
}
return _fileSystemDelegate!.type(path, followLinks: followLinks);
return _fileSystemDelegate.type(path, followLinks: followLinks);
}

@override
FileSystemEntityType fseGetTypeSync(String path, bool followLinks) {
if (_fileSystemDelegate == null) {
return super.fseGetTypeSync(path, followLinks);
}
return _fileSystemDelegate!.typeSync(path, followLinks: followLinks);
return _fileSystemDelegate.typeSync(path, followLinks: followLinks);
}

@override
Future<bool> fseIdentical(String path1, String path2) {
if (_fileSystemDelegate == null) {
return super.fseIdentical(path1, path2);
}
return _fileSystemDelegate!.identical(path1, path2);
return _fileSystemDelegate.identical(path1, path2);
}

@override
bool fseIdenticalSync(String path1, String path2) {
if (_fileSystemDelegate == null) {
return super.fseIdenticalSync(path1, path2);
}
return _fileSystemDelegate!.identicalSync(path1, path2);
return _fileSystemDelegate.identicalSync(path1, path2);
}

@override
io.Directory getCurrentDirectory() {
if (_fileSystemDelegate == null) {
return super.getCurrentDirectory();
}
return _fileSystemDelegate!.currentDirectory;
return _fileSystemDelegate.currentDirectory;
}

@override
io.Directory getSystemTempDirectory() {
if (_fileSystemDelegate == null) {
return super.getSystemTempDirectory();
}
return _fileSystemDelegate!.systemTempDirectory;
return _fileSystemDelegate.systemTempDirectory;
}

@override
void setCurrentDirectory(String path) {
if (_fileSystemDelegate == null) {
return super.setCurrentDirectory(path);
}
_fileSystemDelegate!.currentDirectory = path;
_fileSystemDelegate.currentDirectory = path;
}

@override
Future<FileStat> stat(String path) {
if (_fileSystemDelegate == null) {
return super.stat(path);
}
return _fileSystemDelegate!.stat(path);
return _fileSystemDelegate.stat(path);
}

@override
FileStat statSync(String path) {
if (_fileSystemDelegate == null) {
return super.statSync(path);
}
return _fileSystemDelegate!.statSync(path);
return _fileSystemDelegate.statSync(path);
}
}
2 changes: 1 addition & 1 deletion packages/pigeon/lib/pigeon_lib.dart
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ class PigeonOptions {
if (oneLanguage != null) 'oneLanguage': oneLanguage!,
if (debugGenerators != null) 'debugGenerators': debugGenerators!,
if (basePath != null) 'basePath': basePath!,
if (_dartPackageName != null) 'dartPackageName': _dartPackageName!,
if (_dartPackageName != null) 'dartPackageName': _dartPackageName,
};
return result;
}
Expand Down