Skip to content

Commit

Permalink
v0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanblake4 committed Oct 29, 2023
1 parent f20ab67 commit 79f1e56
Show file tree
Hide file tree
Showing 64 changed files with 2,544 additions and 1,514 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.7.0
- Upgrade to dart_eval v0.7.0
- Documentation improvements

## 0.6.1+1
- Fix FontWeight enum mappings

Expand Down
19 changes: 10 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
[![Web example](https://img.shields.io/badge/web-example-blue.svg)](https://ethanblake.xyz/evalpad)

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

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

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

Although flutter_eval is already the best solution for native Dart Flutter code push,
the project is still in development and you should not expect all existing Flutter/Dart code
to work without modification, as various standard library classes and Dart features
have yet to be implemented.
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
see a list of supported widgets and classes [here](#supported-widgets-and-classes)
and a list of supported Dart features on the [dart_eval Pub page](https://pub.dev/packages/dart_eval/#language-feature-support-table).

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)

## Quickstart for code push

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

## Quickstart for dynamic execution and manual updates
## Quickstart for dynamic execution and server-driven UI

To create a simple dynamic stateless widget, add and modify the following inside a
build() method or as a child parameter:
Expand Down
7 changes: 7 additions & 0 deletions example/windows/runner/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,13 @@ add_executable(${BINARY_NAME} WIN32
# that need different build settings.
apply_standard_settings(${BINARY_NAME})

# Add preprocessor definitions for the build version.
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION=\"${FLUTTER_VERSION}\"")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MAJOR=${FLUTTER_VERSION_MAJOR}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_MINOR=${FLUTTER_VERSION_MINOR}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_PATCH=${FLUTTER_VERSION_PATCH}")
target_compile_definitions(${BINARY_NAME} PRIVATE "FLUTTER_VERSION_BUILD=${FLUTTER_VERSION_BUILD}")

# Disable Windows macros that collide with C++ standard library functions.
target_compile_definitions(${BINARY_NAME} PRIVATE "NOMINMAX")

Expand Down
10 changes: 5 additions & 5 deletions example/windows/runner/Runner.rc
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,14 @@ IDI_APP_ICON ICON "resources\\app_icon.ico"
// Version
//

#ifdef FLUTTER_BUILD_NUMBER
#define VERSION_AS_NUMBER FLUTTER_BUILD_NUMBER
#if defined(FLUTTER_VERSION_MAJOR) && defined(FLUTTER_VERSION_MINOR) && defined(FLUTTER_VERSION_PATCH) && defined(FLUTTER_VERSION_BUILD)
#define VERSION_AS_NUMBER FLUTTER_VERSION_MAJOR,FLUTTER_VERSION_MINOR,FLUTTER_VERSION_PATCH,FLUTTER_VERSION_BUILD
#else
#define VERSION_AS_NUMBER 1,0,0
#define VERSION_AS_NUMBER 1,0,0,0
#endif

#ifdef FLUTTER_BUILD_NAME
#define VERSION_AS_STRING #FLUTTER_BUILD_NAME
#if defined(FLUTTER_VERSION)
#define VERSION_AS_STRING FLUTTER_VERSION
#else
#define VERSION_AS_STRING "1.0.0"
#endif
Expand Down
5 changes: 3 additions & 2 deletions examples/code_push_app/hot_update/lib/hot_update.dart
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
// ignore_for_file: no_leading_underscores_for_local_identifiers
library hot_update;

import 'package:eval_annotation/eval_annotation.dart';
import 'package:flutter/material.dart';

@RuntimeOverride('#myapp_main_scaffold_1')
// ignore: no_leading_underscores_for_local_identifiers
Widget scaffoldUpdate(BuildContext context, int counter, void Function() _incrementCounter) {
Widget scaffoldUpdate(
BuildContext context, int counter, void Function() _incrementCounter) {
return Scaffold(
appBar: AppBar(
title: const Text("Time counter"),
Expand Down
6 changes: 4 additions & 2 deletions examples/code_push_app/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ class MyApp extends StatelessWidget {
return HotSwapLoader(
// Updates can be loaded from the network using http:// and https://,
// or from local files/Flutter assets using file:// and asset:// respectively.
uri: 'https://storage.googleapis.com/eval-files/update.evc',
uri: 'https://storage.googleapis.com/eval-files/update4.evc',
child: MaterialApp(
title: 'Flutter Demo',
theme: ThemeData(
Expand Down Expand Up @@ -94,7 +94,9 @@ class _MyHomePageState extends State<MyHomePage> {

/// Hot-swaps can be nested, so smaller updates can be made with
/// minimal performance impact
child: HotSwap(id: '#myapp_fab_icon', childBuilder: (context) => const Icon(Icons.add))),
child: HotSwap(
id: '#myapp_fab_icon',
childBuilder: (context) => const Icon(Icons.add))),
),
);
}
Expand Down
3 changes: 3 additions & 0 deletions examples/code_push_app/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ dev_dependencies:
flutter_lints: ^2.0.0
flutter:
uses-material-design: true

assets:
- assets/update.evc
5 changes: 5 additions & 0 deletions examples/code_push_app/windows/runner/flutter_window.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ bool FlutterWindow::OnCreate() {
this->Show();
});

// Flutter can complete the first frame before the "show window" callback is
// registered. The following call ensures a frame is pending to ensure the
// window is shown. It is a no-op if the first frame hasn't completed yet.
flutter_controller_->ForceRedraw();

return true;
}

Expand Down
Loading

0 comments on commit 79f1e56

Please sign in to comment.