Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 12 additions & 1 deletion ohos/src/main/ets/components/FlutterBoost.ets
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,17 @@ export class FlutterBoost {
});
}

public async unsetFlutterBoost() {
this.plugin?.setDelegate(null);
this.plugin = null;
this.delegate = null;

FlutterEngineCache.getInstance().remove(FlutterBoost.ENGINE_ID);
// 暂时不调用,会crash
// this.flutterEngine?.destroy();
this.flutterEngine = null;
}

/**
* 打开页面
* @param pageName 页面名称
Expand Down Expand Up @@ -226,4 +237,4 @@ export class FlutterBoost {
public isTopContainer(container: FlutterViewContainer): boolean {
return FlutterContainerManager.getInstance().getTopContainer() == container;
}
}
}
4 changes: 2 additions & 2 deletions ohos/src/main/ets/components/plugin/FlutterBoostPlugin.ets
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ export class FlutterBoostPlugin implements FlutterPlugin, MethodCallHandler, Nat
}

// public method
public setDelegate(delegate: FlutterBoostDelegate) {
public setDelegate(delegate: FlutterBoostDelegate | null) {
this.delegate = delegate;
}

Expand Down Expand Up @@ -485,4 +485,4 @@ export class FlutterBoostPlugin implements FlutterPlugin, MethodCallHandler, Nat
}
return value;
}
}
}