Skip to content

Commit 79f1e56

Browse files
committed
v0.7.0
1 parent f20ab67 commit 79f1e56

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

64 files changed

+2544
-1514
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,7 @@
1+
## 0.7.0
2+
- Upgrade to dart_eval v0.7.0
3+
- Documentation improvements
4+
15
## 0.6.1+1
26
- Fix FontWeight enum mappings
37

README.md

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
[![Web example](https://img.shields.io/badge/web-example-blue.svg)](https://ethanblake.xyz/evalpad)
44

55
`flutter_eval` is a Flutter bridge library for [dart_eval](https://pub.dev/packages/dart_eval),
6-
and a solution enabling both fully dynamic runtime code-push and runtime evaluation of Flutter code.
7-
It can be used to enable hot-swapping parts of your app with an over-the-air update, or for dynamically
8-
evaluating code based on user input such as in a calculator. flutter_eval supports all platforms
9-
including iOS and is built on dart_eval's custom bytecode interpreter, making it very fast.
6+
and a solution enabling code-push, dynamic widgets, and runtime evaluation of Flutter code.
7+
It can be used to enable hot-swapping parts of your app with an over-the-air update, dynamically loading UI from a server, or evaluating code based on user input such as in a calculator.
8+
flutter_eval supports all platforms including iOS and is built on dart_eval's
9+
custom bytecode interpreter, making it very fast.
1010

1111
| dart_eval | [![pub package](https://img.shields.io/pub/v/dart_eval.svg?label=dart_eval&color=teal)](https://pub.dev/packages/dart_eval) |
1212
| ------------ | ------------------------------------------------------------------------------------------------------------------------------------ |
@@ -15,10 +15,11 @@ including iOS and is built on dart_eval's custom bytecode interpreter, making it
1515

1616
For a live example, check out [EvalPad](https://ethanblake.xyz/evalpad).
1717

18-
Although flutter_eval is already the best solution for native Dart Flutter code push,
19-
the project is still in development and you should not expect all existing Flutter/Dart code
20-
to work without modification, as various standard library classes and Dart features
21-
have yet to be implemented.
18+
Note: While flutter_eval supports most Flutter and Dart features, it does not support all of them. Existing code may need modification to work. You can
19+
see a list of supported widgets and classes [here](#supported-widgets-and-classes)
20+
and a list of supported Dart features on the [dart_eval Pub page](https://pub.dev/packages/dart_eval/#language-feature-support-table).
21+
22+
See: [Quickstart for code push](#quickstart-for-code-push) | [Quickstart for dynamic execution and server-driven UI](#quickstart-for-dynamic-execution-and-server-driven-ui) | [Supported widgets and classes](#supported-widgets-and-classes)
2223

2324
## Quickstart for code push
2425

@@ -126,7 +127,7 @@ For a complete example of code push, see
126127
[examples/code_push_app](https://github.com/ethanblake4/flutter_eval/tree/master/examples/code_push_app)
127128
and its subfolder [hot_update](https://github.com/ethanblake4/flutter_eval/tree/master/examples/code_push_app/hot_update).
128129

129-
## Quickstart for dynamic execution and manual updates
130+
## Quickstart for dynamic execution and server-driven UI
130131

131132
To create a simple dynamic stateless widget, add and modify the following inside a
132133
build() method or as a child parameter:

example/windows/runner/CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,13 @@ add_executable(${BINARY_NAME} WIN32
2020
# that need different build settings.
2121
apply_standard_settings(${BINARY_NAME})
2222

23+
# Add preprocessor definitions for the build version.
24+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
25+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
26+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
27+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
28+
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")
29+
2330
# Disable Windows macros that collide with C++ standard library functions.
2431
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")
2532

example/windows/runner/Runner.rc

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
6060
// Version
6161
//
6262

63-
#ifdef FLUTTER_BUILD_NUMBER
64-
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
63+
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
64+
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
6565
#else
66-
#define VERSION_AS_NUMBER 1,0,0
66+
#define VERSION_AS_NUMBER 1,0,0,0
6767
#endif
6868

69-
#ifdef FLUTTER_BUILD_NAME
70-
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
69+
#if defined(FLUTTER_VERSION)
70+
#define VERSION_AS_STRING FLUTTER_VERSION
7171
#else
7272
#define VERSION_AS_STRING "1.0.0"
7373
#endif

examples/code_push_app/hot_update/lib/hot_update.dart

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,12 @@
1+
// ignore_for_file: no_leading_underscores_for_local_identifiers
12
library hot_update;
23

34
import 'package:eval_annotation/eval_annotation.dart';
45
import 'package:flutter/material.dart';
56

67
@RuntimeOverride('#myapp_main_scaffold_1')
7-
// ignore: no_leading_underscores_for_local_identifiers
8-
Widget scaffoldUpdate(BuildContext context, int counter, void Function() _incrementCounter) {
8+
Widget scaffoldUpdate(
9+
BuildContext context, int counter, void Function() _incrementCounter) {
910
return Scaffold(
1011
appBar: AppBar(
1112
title: const Text("Time counter"),

examples/code_push_app/lib/main.dart

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ class MyApp extends StatelessWidget {
1717
return HotSwapLoader(
1818
// Updates can be loaded from the network using http:// and https://,
1919
// or from local files/Flutter assets using file:// and asset:// respectively.
20-
uri: 'https://storage.googleapis.com/eval-files/update.evc',
20+
uri: 'https://storage.googleapis.com/eval-files/update4.evc',
2121
child: MaterialApp(
2222
title: 'Flutter Demo',
2323
theme: ThemeData(
@@ -94,7 +94,9 @@ class _MyHomePageState extends State<MyHomePage> {
9494

9595
/// Hot-swaps can be nested, so smaller updates can be made with
9696
/// minimal performance impact
97-
child: HotSwap(id: '#myapp_fab_icon', childBuilder: (context) => const Icon(Icons.add))),
97+
child: HotSwap(
98+
id: '#myapp_fab_icon',
99+
childBuilder: (context) => const Icon(Icons.add))),
98100
),
99101
);
100102
}

examples/code_push_app/pubspec.yaml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,6 @@ dev_dependencies:
1515
flutter_lints: ^2.0.0
1616
flutter:
1717
uses-material-design: true
18+
19+
assets:
20+
- assets/update.evc

examples/code_push_app/windows/runner/flutter_window.cpp

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,11 @@ bool FlutterWindow::OnCreate() {
3131
this->Show();
3232
});
3333

34+
// Flutter can complete the first frame before the "show window" callback is
35+
// registered. The following call ensures a frame is pending to ensure the
36+
// window is shown. It is a no-op if the first frame hasn't completed yet.
37+
flutter_controller_->ForceRedraw();
38+
3439
return true;
3540
}
3641

0 commit comments

Comments
 (0)