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
a34e6b07
Unverified
Commit
a34e6b07
authored
Sep 12, 2022
by
Kenzie Davisson
Committed by
GitHub
Sep 12, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Create enum for service extensions in services library (#111412)
parent
11fdced5
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
30 additions
and
6 deletions
+30
-6
services.dart
packages/flutter/lib/services.dart
+1
-0
binding.dart
packages/flutter/lib/src/services/binding.dart
+2
-5
service_extensions.dart
packages/flutter/lib/src/services/service_extensions.dart
+26
-0
service_extensions_test.dart
...ages/flutter/test/foundation/service_extensions_test.dart
+1
-1
No files found.
packages/flutter/lib/services.dart
View file @
a34e6b07
...
...
@@ -37,6 +37,7 @@ export 'src/services/raw_keyboard_macos.dart';
export
'src/services/raw_keyboard_web.dart'
;
export
'src/services/raw_keyboard_windows.dart'
;
export
'src/services/restoration.dart'
;
export
'src/services/service_extensions.dart'
;
export
'src/services/spell_check.dart'
;
export
'src/services/system_channels.dart'
;
export
'src/services/system_chrome.dart'
;
...
...
packages/flutter/lib/src/services/binding.dart
View file @
a34e6b07
...
...
@@ -15,6 +15,7 @@ import 'binary_messenger.dart';
import
'hardware_keyboard.dart'
;
import
'message_codec.dart'
;
import
'restoration.dart'
;
import
'service_extensions.dart'
;
import
'system_channels.dart'
;
import
'text_input.dart'
;
...
...
@@ -213,11 +214,7 @@ mixin ServicesBinding on BindingBase, SchedulerBinding {
assert
(()
{
registerStringServiceExtension
(
// ext.flutter.evict value=foo.png will cause foo.png to be evicted from
// the rootBundle cache and cause the entire image cache to be cleared.
// This is used by hot reload mode to clear out the cache of resources
// that have changed.
name:
'evict'
,
name:
ServicesServiceExtensions
.
evict
.
name
,
getter:
()
async
=>
''
,
setter:
(
String
value
)
async
{
evict
(
value
);
...
...
packages/flutter/lib/src/services/service_extensions.dart
0 → 100644
View file @
a34e6b07
// Copyright 2014 The Flutter Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// Service extension constants for the services library.
///
/// These constants will be used when registering service extensions in the
/// framework, and they will also be used by tools and services that call these
/// service extensions.
///
/// The String value for each of these extension names should be accessed by
/// calling the `.name` property on the enum value.
enum
ServicesServiceExtensions
{
/// Name of service extension that, when called, will evict an image from the
/// rootBundle cache and cause the image cache to be cleared.
///
/// This is used by hot reload mode to clear out the cache of resources that
/// have changed. This service extension should be called with a String value
/// of the image path (e.g. foo.png).
///
/// See also:
///
/// * [ServicesBinding.initServiceExtensions], where the service extension is
/// registered.
evict
,
}
packages/flutter/test/foundation/service_extensions_test.dart
View file @
a34e6b07
...
...
@@ -563,7 +563,7 @@ void main() {
});
expect
(
data
,
isTrue
);
expect
(
completed
,
isFalse
);
result
=
await
binding
.
testExtension
(
'evict'
,
<
String
,
String
>{
'value'
:
'test'
});
result
=
await
binding
.
testExtension
(
ServicesServiceExtensions
.
evict
.
name
,
<
String
,
String
>{
'value'
:
'test'
});
expect
(
result
,
<
String
,
String
>{
'value'
:
''
});
expect
(
completed
,
isFalse
);
data
=
await
rootBundle
.
loadStructuredData
<
bool
>(
'test'
,
(
String
value
)
async
{
...
...
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