Skip to content

Commit

Permalink
Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
xvrh committed Sep 19, 2023
1 parent e521bae commit be93277
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 26 deletions.
24 changes: 7 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,17 @@ void main() async {

#### Develop the app using Flutter Desktop

In order to develop in a comfortable environment with hot-reload and hot-restart working,
develop most of the app using Flutter desktop.
In order to develop in a comfortable environment with hot-reload,
most of the app can be developed using Flutter desktop.

The app needs an abstraction layer between the UI and the `chrome_extension` APIs.
This will require an abstraction layer between the UI and the `chrome_extension` APIs.

The desktop entry point injects a fake implementation of this abstraction layer to be runnable on Desktop.
A fake implementation of this abstraction layer is used in the Desktop entry point:

```dart
// lib/main_desktop.dart
void main() {
// In the desktop entry point, injects a fake service that doesn't use the
// real chrome_extension package.
// Inject a fake service that doesn't use the real chrome_extension package.
var service = FakeBookmarkService();
runApp(MyExtensionPopup(service));
}
Expand All @@ -152,10 +151,10 @@ class FakeBookmarkService implements BookmarkService {
}
```

Launch this entry point with
Launch this entry point in desktop with
`flutter run -t lib/main_desktop.dart -d macos|windows|linux`

Create the real entry point and compile it with a custom build script
Create the real entry point:

```dart
// lib/main.dart
Expand Down Expand Up @@ -200,13 +199,6 @@ class ChromeBookmarkService implements BookmarkService {
```

```dart
import 'dart:io';
import 'package:process_runner/process_runner.dart';
final _process = ProcessRunner(printOutputDefault: true);
// --- example
// tool/build.dart
void main() async {
await _process.runProcess([
Expand Down Expand Up @@ -234,8 +226,6 @@ void main() async {
]);
}
}
// ---
```

It builds the flutter app and compiles all the other Dart scripts
Expand Down
14 changes: 7 additions & 7 deletions README.template.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,21 @@ import 'example/example.dart';

#### Develop the app using Flutter Desktop

In order to develop in a comfortable environment with hot-reload and hot-restart working,
develop most of the app using Flutter desktop.
In order to develop in a comfortable environment with hot-reload,
most of the app can be developed using Flutter desktop.

The app needs an abstraction layer between the UI and the `chrome_extension` APIs.
This will require an abstraction layer between the UI and the `chrome_extension` APIs.

The desktop entry point injects a fake implementation of this abstraction layer to be runnable on Desktop.
A fake implementation of this abstraction layer is used in the Desktop entry point:

```dart
import 'example/desktop_entry_point.dart#example';
```

Launch this entry point with
Launch this entry point in desktop with
`flutter run -t lib/main_desktop.dart -d macos|windows|linux`

Create the real entry point and compile it with a custom build script
Create the real entry point:

```dart
import 'example/real_entry_point.dart#example';
Expand Down Expand Up @@ -77,7 +77,7 @@ import 'example/real_entry_point.dart#example';
```

```dart
import 'example/build_script.dart';
import 'example/build_script.dart#example';
```

It builds the flutter app and compiles all the other Dart scripts
Expand Down
3 changes: 1 addition & 2 deletions example/desktop_entry_point.dart
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@

// lib/main_desktop.dart
void main() {
// In the desktop entry point, injects a fake service that doesn't use the
// real chrome_extension package.
// Inject a fake service that doesn't use the real chrome_extension package.
var service = FakeBookmarkService();
runApp(MyExtensionPopup(service));
}
Expand Down

0 comments on commit be93277

Please sign in to comment.