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
57dc5f29
Unverified
Commit
57dc5f29
authored
Mar 11, 2021
by
Gary Qian
Committed by
GitHub
Mar 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Rename 'moduleName' to 'componentName' (#77789)
parent
8b889d35
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
28 deletions
+27
-28
deferred_component.dart
packages/flutter/lib/src/services/deferred_component.dart
+14
-14
system_channels.dart
packages/flutter/lib/src/services/system_channels.dart
+9
-10
deferred_component_test.dart
packages/flutter/test/services/deferred_component_test.dart
+4
-4
No files found.
packages/flutter/lib/src/services/deferred_component.dart
View file @
57dc5f29
...
...
@@ -6,7 +6,7 @@ import 'dart:async';
import
'system_channels.dart'
;
/// Manages the installation and loading of deferred component
module
s.
/// Manages the installation and loading of deferred components.
///
/// Deferred components allow Flutter applications to download precompiled AOT
/// dart code and assets at runtime, reducing the install size of apps and
...
...
@@ -25,12 +25,12 @@ class DeferredComponent {
// prevents instantiation and extension.
DeferredComponent
.
_
();
// TODO(garyq): We should eventually expand this to install
module
s by loadingUnitId
// as well as
module
Name, but currently, loadingUnitId is opaque to the dart code
// TODO(garyq): We should eventually expand this to install
component
s by loadingUnitId
// as well as
component
Name, but currently, loadingUnitId is opaque to the dart code
// so this is not possible. The API has been left flexible to allow adding
// loadingUnitId as a parameter.
/// Requests that an assets-only deferred component identified by the [
module
Name]
/// Requests that an assets-only deferred component identified by the [
component
Name]
/// be downloaded and installed.
///
/// This method returns a Future<void> that will complete when the feature is
...
...
@@ -45,14 +45,14 @@ class DeferredComponent {
/// library loading process. For example:
///
/// ```dart
/// import 'split_
module.dart' deferred as SplitModule
;
/// import 'split_
component.dart' deferred as SplitComponent
;
/// ...
/// Split
Module
.loadLibrary();
/// Split
Component
.loadLibrary();
/// ```
///
/// This method will not load associated dart libraries contained in the
dynamic
///
feature module, though it will download the files necessary and subsequent
///
calls to `loadLibrary()`
to load will complete faster.
/// This method will not load associated dart libraries contained in the
component,
///
though it will download the files necessary and subsequent calls to `loadLibrary()`
/// to load will complete faster.
///
/// Assets installed by this method may be accessed in the same way as any other
/// local asset by providing a string path to the asset.
...
...
@@ -63,14 +63,14 @@ class DeferredComponent {
/// * [loadLibrary](https://api.dart.dev/dart-mirrors/LibraryDependencyMirror/loadLibrary.html),
/// the dart method to trigger the installation of the corresponding deferred component that
/// contains the dart library.
static
Future
<
void
>
installDeferredComponent
({
required
String
module
Name
})
async
{
static
Future
<
void
>
installDeferredComponent
({
required
String
component
Name
})
async
{
await
SystemChannels
.
deferredComponent
.
invokeMethod
<
void
>(
'installDeferredComponent'
,
<
String
,
dynamic
>{
'loadingUnitId'
:
-
1
,
'
moduleName'
:
module
Name
},
<
String
,
dynamic
>{
'loadingUnitId'
:
-
1
,
'
componentName'
:
component
Name
},
);
}
/// Requests that a deferred component identified by the [
module
Name] be
/// Requests that a deferred component identified by the [
component
Name] be
/// uninstalled.
///
/// Since uninstallation typically requires significant disk i/o, this method only
...
...
@@ -91,10 +91,10 @@ class DeferredComponent {
/// * [loadLibrary](https://api.dart.dev/dart-mirrors/LibraryDependencyMirror/loadLibrary.html),
/// the dart method to trigger the installation of the corresponding deferred component that
/// contains the dart library.
static
Future
<
void
>
uninstallDeferredComponent
({
required
String
module
Name
})
async
{
static
Future
<
void
>
uninstallDeferredComponent
({
required
String
component
Name
})
async
{
await
SystemChannels
.
deferredComponent
.
invokeMethod
<
void
>(
'uninstallDeferredComponent'
,
<
String
,
dynamic
>{
'loadingUnitId'
:
-
1
,
'
moduleName'
:
module
Name
},
<
String
,
dynamic
>{
'loadingUnitId'
:
-
1
,
'
componentName'
:
component
Name
},
);
}
}
packages/flutter/lib/src/services/system_channels.dart
View file @
57dc5f29
...
...
@@ -324,17 +324,16 @@ class SystemChannels {
/// [OptionalMethodChannel.invokeMethod]):
///
/// * `installDeferredComponent`: Requests that a deferred component identified by
/// the provided loadingUnitId or moduleName be downloaded and installed.
/// Providing a loadingUnitId with null moduleName will install a dynamic
/// feature module that includes the desired loading unit. If a moduleName
/// is provided, then the deferred component with the moduleName will be installed.
/// This method returns a future that will not be completed until the
/// feature is fully installed and ready to use. When an error occurs, the
/// future will complete an error. Calling `loadLibrary()` on a deferred
/// imported library is equivalent to calling this method with a
/// loadingUnitId and null moduleName.
/// the provided loadingUnitId or componentName be downloaded and installed.
/// Providing a loadingUnitId with null componentName will install a component that
/// includes the desired loading unit. If a componentName is provided, then the
/// deferred component with the componentName will be installed. This method
/// returns a future that will not be completed until the feature is fully installed
/// and ready to use. When an error occurs, the future will complete an error.
/// Calling `loadLibrary()` on a deferred imported library is equivalent to calling
/// this method with a loadingUnitId and null componentName.
/// * `uninstallDeferredComponent`: Requests that a deferred component identified by
/// the provided loadingUnitId or
module
Name be uninstalled. Since
/// the provided loadingUnitId or
component
Name be uninstalled. Since
/// uninstallation typically requires significant disk i/o, this method only
/// signals the intent to uninstall. Actual uninstallation (eg, removal of
/// assets and files) may occur at a later time. However, once uninstallation
...
...
packages/flutter/test/services/deferred_component_test.dart
View file @
57dc5f29
...
...
@@ -15,12 +15,12 @@ void main() {
log
.
add
(
methodCall
);
});
await
DeferredComponent
.
installDeferredComponent
(
moduleName:
'testModule
Name'
);
await
DeferredComponent
.
installDeferredComponent
(
componentName:
'testComponent
Name'
);
expect
(
log
,
hasLength
(
1
));
expect
(
log
.
single
,
isMethodCall
(
'installDeferredComponent'
,
arguments:
<
String
,
dynamic
>{
'loadingUnitId'
:
-
1
,
'
moduleName'
:
'testModule
Name'
},
arguments:
<
String
,
dynamic
>{
'loadingUnitId'
:
-
1
,
'
componentName'
:
'testComponent
Name'
},
));
});
...
...
@@ -31,12 +31,12 @@ void main() {
log
.
add
(
methodCall
);
});
await
DeferredComponent
.
uninstallDeferredComponent
(
moduleName:
'testModule
Name'
);
await
DeferredComponent
.
uninstallDeferredComponent
(
componentName:
'testComponent
Name'
);
expect
(
log
,
hasLength
(
1
));
expect
(
log
.
single
,
isMethodCall
(
'uninstallDeferredComponent'
,
arguments:
<
String
,
dynamic
>{
'loadingUnitId'
:
-
1
,
'
moduleName'
:
'testModule
Name'
},
arguments:
<
String
,
dynamic
>{
'loadingUnitId'
:
-
1
,
'
componentName'
:
'testComponent
Name'
},
));
});
}
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