diff --git a/packages/flutter_tools/doc/daemon.md b/packages/flutter_tools/doc/daemon.md index 459ed8646c..638594cd05 100644 --- a/packages/flutter_tools/doc/daemon.md +++ b/packages/flutter_tools/doc/daemon.md @@ -108,15 +108,9 @@ The `restart()` restarts the given application. It returns a Map of `{ int code, - `pause`: optional; when doing a hot restart the isolate should enter a paused mode - `debounce`: optional; whether to automatically debounce multiple requests sent in quick succession (this may introduce a short delay in processing the request) -#### app.reloadMethod +#### app.reloadMethod (Removed) -Performs a limited hot restart which does not sync assets and only marks elements as dirty, instead of reassembling the full application. A `code` of `0` indicates success, and non-zero indicates a failure. - -- `appId`: the id of a previously started app; this is required. -- `library`: the absolute file URI of the library to be updated; this is required. -- `class`: the name of the StatelessWidget that was updated, or the StatefulWidget -corresponding to the updated State class; this is required. -- `debounce`: optional; whether to automatically debounce multiple requests sent in quick succession (this may introduce a short delay in processing the request) +This functionality was deprecated and removed after Flutter version 1.23.0 #### app.callServiceExtension diff --git a/packages/flutter_tools/lib/src/commands/daemon.dart b/packages/flutter_tools/lib/src/commands/daemon.dart index ac7c2927cb..6d45a0a207 100644 --- a/packages/flutter_tools/lib/src/commands/daemon.dart +++ b/packages/flutter_tools/lib/src/commands/daemon.dart @@ -423,7 +423,6 @@ typedef _RunOrAttach = Future Function({ class AppDomain extends Domain { AppDomain(Daemon daemon) : super(daemon, 'app') { registerHandler('restart', restart); - registerHandler('reloadMethod', reloadMethod); registerHandler('callServiceExtension', callServiceExtension); registerHandler('stop', stop); registerHandler('detach', detach); @@ -638,28 +637,6 @@ class AppDomain extends Domain { ); } - Future reloadMethod(Map args) async { - final String appId = _getStringArg(args, 'appId', required: true); - final String classId = _getStringArg(args, 'class', required: true); - final String libraryId = _getStringArg(args, 'library', required: true); - final bool debounce = _getBoolArg(args, 'debounce') ?? false; - - final AppInstance app = _getApp(appId); - if (app == null) { - throw "app '$appId' not found"; - } - - return _queueAndDebounceReloadAction( - app, - OperationType.reloadMethod, - debounce, - null, - () { - return app.reloadMethod(classId: classId, libraryId: libraryId); - }, - ); - } - /// Debounce and queue reload actions. /// /// Only one reload action will run at a time. Actions requested in quick @@ -1094,10 +1071,6 @@ class AppInstance { return runner.restart(fullRestart: fullRestart, pause: pause, reason: reason); } - Future reloadMethod({ String classId, String libraryId }) { - return runner.reloadMethod(classId: classId, libraryId: libraryId); - } - Future stop() => runner.exit(); Future detach() => runner.detach(); @@ -1353,7 +1326,6 @@ class LaunchMode { } enum OperationType { - reloadMethod, reload, restart } diff --git a/packages/flutter_tools/lib/src/resident_runner.dart b/packages/flutter_tools/lib/src/resident_runner.dart index 97d0c912c6..f2282ea17f 100644 --- a/packages/flutter_tools/lib/src/resident_runner.dart +++ b/packages/flutter_tools/lib/src/resident_runner.dart @@ -210,7 +210,6 @@ class FlutterDevice { ReloadSources reloadSources, Restart restart, CompileExpression compileExpression, - ReloadMethod reloadMethod, GetSkSLMethod getSkSLMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod, int hostVmServicePort, @@ -259,7 +258,6 @@ class FlutterDevice { reloadSources: reloadSources, restart: restart, compileExpression: compileExpression, - reloadMethod: reloadMethod, getSkSLMethod: getSkSLMethod, printStructuredErrorLogMethod: printStructuredErrorLogMethod, device: device, @@ -951,22 +949,6 @@ abstract class ResidentRunner { return sharedSkSlWriter(device, data); } - /// The resident runner API for interaction with the reloadMethod vmservice - /// request. - /// - /// This API should only be called for UI only-changes spanning a single - /// library/Widget. - /// - /// The value [classId] should be the identifier of the StatelessWidget that - /// was invalidated, or the StatefulWidget for the corresponding State class - /// that was invalidated. This must be provided. - /// - /// The value [libraryId] should be the absolute file URI for the containing - /// library of the widget that was invalidated. This must be provided. - Future reloadMethod({ String classId, String libraryId }) { - throw UnsupportedError('Method is not supported.'); - } - @protected void writeVmserviceFile() { if (debuggingOptions.vmserviceOutFile != null) { @@ -1259,7 +1241,6 @@ abstract class ResidentRunner { ReloadSources reloadSources, Restart restart, CompileExpression compileExpression, - ReloadMethod reloadMethod, GetSkSLMethod getSkSLMethod, }) async { if (!debuggingOptions.debuggingEnabled) { @@ -1275,7 +1256,6 @@ abstract class ResidentRunner { disableDds: debuggingOptions.disableDds, ddsPort: debuggingOptions.ddsPort, hostVmServicePort: debuggingOptions.hostVmServicePort, - reloadMethod: reloadMethod, getSkSLMethod: getSkSLMethod, printStructuredErrorLogMethod: printStructuredErrorLog, ipv6: ipv6, diff --git a/packages/flutter_tools/lib/src/run_hot.dart b/packages/flutter_tools/lib/src/run_hot.dart index 1b10061d86..ca47cd146b 100644 --- a/packages/flutter_tools/lib/src/run_hot.dart +++ b/packages/flutter_tools/lib/src/run_hot.dart @@ -167,19 +167,6 @@ class HotRunner extends ResidentRunner { throw 'Failed to compile $expression'; } - @override - Future reloadMethod({ String libraryId, String classId }) async { - final OperationResult result = await restart(pause: false); - if (!result.isOk) { - throw vm_service.RPCError( - 'Unable to reload sources', - RPCErrorCodes.kInternalError, - '', - ); - } - return result; - } - // Returns the exit code of the flutter tool process, like [run]. @override Future attach({ @@ -192,7 +179,6 @@ class HotRunner extends ResidentRunner { reloadSources: _reloadSourcesService, restart: _restartService, compileExpression: _compileExpressionService, - reloadMethod: reloadMethod, getSkSLMethod: writeSkSL, ); // Catches all exceptions, non-Exception objects are rethrown. diff --git a/packages/flutter_tools/lib/src/vmservice.dart b/packages/flutter_tools/lib/src/vmservice.dart index e995207b16..c261ac1d34 100644 --- a/packages/flutter_tools/lib/src/vmservice.dart +++ b/packages/flutter_tools/lib/src/vmservice.dart @@ -79,12 +79,6 @@ typedef CompileExpression = Future Function( bool isStatic, ); -typedef ReloadMethod = Future Function({ - String classId, - String libraryId, -}); - - /// A method that pulls an SkSL shader from the device and writes it to a file. /// /// The name of the file returned as a result. @@ -147,7 +141,6 @@ typedef VMServiceConnector = Future Function(Uri httpUri, ReloadSources reloadSources, Restart restart, CompileExpression compileExpression, - ReloadMethod reloadMethod, GetSkSLMethod getSkSLMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod, io.CompressionOptions compression, @@ -174,7 +167,6 @@ vm_service.VmService setUpVmService( Restart restart, CompileExpression compileExpression, Device device, - ReloadMethod reloadMethod, GetSkSLMethod skSLMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod, vm_service.VmService vmService @@ -196,32 +188,6 @@ vm_service.VmService setUpVmService( vmService.registerService('reloadSources', 'Flutter Tools'); } - if (reloadMethod != null) { - // Register a special method for hot UI. while this is implemented - // currently in the same way as hot reload, it leaves the tool free - // to change to a more efficient implementation in the future. - // - // `library` should be the file URI of the updated code. - // `class` should be the name of the Widget subclass to be marked dirty. For example, - // if the build method of a StatelessWidget is updated, this is the name of class. - // If the build method of a StatefulWidget is updated, then this is the name - // of the Widget class that created the State object. - vmService.registerServiceCallback('reloadMethod', (Map params) async { - final String libraryId = _validateRpcStringParam('reloadMethod', params, 'library'); - final String classId = _validateRpcStringParam('reloadMethod', params, 'class'); - - globals.printTrace('reloadMethod not yet supported, falling back to hot reload'); - - await reloadMethod(libraryId: libraryId, classId: classId); - return { - 'result': { - 'type': 'Success', - } - }; - }); - vmService.registerService('reloadMethod', 'Flutter Tools'); - } - if (restart != null) { vmService.registerServiceCallback('hotRestart', (Map params) async { final bool pause = _validateRpcBoolParam('compileExpression', params, 'pause'); @@ -318,7 +284,6 @@ Future connectToVmService( ReloadSources reloadSources, Restart restart, CompileExpression compileExpression, - ReloadMethod reloadMethod, GetSkSLMethod getSkSLMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod, io.CompressionOptions compression = io.CompressionOptions.compressionDefault, @@ -331,7 +296,6 @@ Future connectToVmService( compileExpression: compileExpression, compression: compression, device: device, - reloadMethod: reloadMethod, getSkSLMethod: getSkSLMethod, printStructuredErrorLogMethod: printStructuredErrorLogMethod, ); @@ -342,7 +306,6 @@ Future _connect( ReloadSources reloadSources, Restart restart, CompileExpression compileExpression, - ReloadMethod reloadMethod, GetSkSLMethod getSkSLMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod, io.CompressionOptions compression = io.CompressionOptions.compressionDefault, @@ -364,7 +327,6 @@ Future _connect( restart, compileExpression, device, - reloadMethod, getSkSLMethod, printStructuredErrorLogMethod, delegateService, diff --git a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart index 41a07b07d7..acfe4a80a4 100644 --- a/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart +++ b/packages/flutter_tools/test/commands.shard/hermetic/attach_test.dart @@ -735,7 +735,6 @@ VMServiceConnector getFakeVmServiceFactory({ ReloadSources reloadSources, Restart restart, CompileExpression compileExpression, - ReloadMethod reloadMethod, GetSkSLMethod getSkSLMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod, CompressionOptions compression, diff --git a/packages/flutter_tools/test/general.shard/cold_test.dart b/packages/flutter_tools/test/general.shard/cold_test.dart index d088367d6e..93b1f1fa78 100644 --- a/packages/flutter_tools/test/general.shard/cold_test.dart +++ b/packages/flutter_tools/test/general.shard/cold_test.dart @@ -134,7 +134,6 @@ class TestFlutterDevice extends FlutterDevice { ReloadSources reloadSources, Restart restart, CompileExpression compileExpression, - ReloadMethod reloadMethod, GetSkSLMethod getSkSLMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod, bool disableDds = false, diff --git a/packages/flutter_tools/test/general.shard/hot_test.dart b/packages/flutter_tools/test/general.shard/hot_test.dart index 2ba2d28fe6..0a38f118f2 100644 --- a/packages/flutter_tools/test/general.shard/hot_test.dart +++ b/packages/flutter_tools/test/general.shard/hot_test.dart @@ -573,7 +573,6 @@ class TestFlutterDevice extends FlutterDevice { ReloadSources reloadSources, Restart restart, CompileExpression compileExpression, - ReloadMethod reloadMethod, GetSkSLMethod getSkSLMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod, bool disableServiceAuthCodes = false, diff --git a/packages/flutter_tools/test/general.shard/resident_runner_test.dart b/packages/flutter_tools/test/general.shard/resident_runner_test.dart index 8078d0eeb5..c047e85376 100644 --- a/packages/flutter_tools/test/general.shard/resident_runner_test.dart +++ b/packages/flutter_tools/test/general.shard/resident_runner_test.dart @@ -2347,7 +2347,6 @@ void main() { ReloadSources reloadSources, Restart restart, CompileExpression compileExpression, - ReloadMethod reloadMethod, GetSkSLMethod getSkSLMethod, PrintStructuredErrorLogMethod printStructuredErrorLogMethod, io.CompressionOptions compression, @@ -2415,7 +2414,6 @@ class FakeFlutterDevice extends FlutterDevice { bool disableServiceAuthCodes = false, bool ipv6 = false, CompileExpression compileExpression, - ReloadMethod reloadMethod, GetSkSLMethod getSkSLMethod, int hostVmServicePort, int ddsPort, diff --git a/packages/flutter_tools/test/general.shard/vmservice_test.dart b/packages/flutter_tools/test/general.shard/vmservice_test.dart index 9587c3ae45..dfb283490c 100644 --- a/packages/flutter_tools/test/general.shard/vmservice_test.dart +++ b/packages/flutter_tools/test/general.shard/vmservice_test.dart @@ -104,7 +104,6 @@ void main() { null, null, null, - null, mockVMService, ); @@ -113,26 +112,6 @@ void main() { Logger: () => BufferLogger.test() }); - testUsingContext('VmService registers reloadMethod', () async { - Future reloadMethod({ String classId, String libraryId,}) async {} - - final MockVMService mockVMService = MockVMService(); - setUpVmService( - null, - null, - null, - null, - reloadMethod, - null, - null, - mockVMService, - ); - - verify(mockVMService.registerService('reloadMethod', 'Flutter Tools')).called(1); - }, overrides: { - Logger: () => BufferLogger.test() - }); - testUsingContext('VmService registers flutterMemoryInfo service', () async { final MockDevice mockDevice = MockDevice(); @@ -144,7 +123,6 @@ void main() { mockDevice, null, null, - null, mockVMService, ); @@ -160,7 +138,6 @@ void main() { null, null, null, - null, () async => 'hello', null, mockVMService, @@ -182,7 +159,6 @@ void main() { null, null, null, - null, (vm_service.Event event) async => 'hello', mockVMService, ); @@ -200,7 +176,6 @@ void main() { null, null, null, - null, mockVMService, );