Skip to content

Commit

Permalink
Update Dart imports
Browse files Browse the repository at this point in the history
  • Loading branch information
temeddix committed Sep 19, 2024
1 parent 0973a5f commit 2229967
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions documentation/docs/frequently-asked-questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -203,7 +203,7 @@ message MyUniqueOutput {

```dart title="lib/main.dart"
import 'dart:async';
import 'package:example_app/messages/exports.dart';
import 'package:example_app/messages/all.dart';
var currentInteractionId = 0;
final myUniqueOutputs = Map<int, Completer<MyUniqueOutput>>();
Expand All @@ -218,7 +218,7 @@ void main() async {

```dart title="lib/main.dart"
import 'dart:async';
import 'package:example_app/messages/exports.dart';
import 'package:example_app/messages/all.dart';
onPressed: () async {
final completer = Completer<MyUniqueOutput>();
Expand Down Expand Up @@ -312,7 +312,7 @@ Failed to load dynamic library 'libhub.so': libhub.so: cannot open shared object
In this case, you can specify a path that points to the compiled Rust library. Simply provide a string path to your dynamic library file.

```dart title="lib/main.dart"
import './messages/exports.dart';
import './messages/all.dart';
async void main() {
await initializeRust(compiledLibPath: '/path/to/library/libhub.so');
Expand Down
6 changes: 3 additions & 3 deletions documentation/docs/tutorial.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ rinf message
Create a button widget in Dart that accepts the user input.

```dart title="lib/main.dart"
import 'package:test_app/messages/exports.dart';
import 'package:test_app/messages/all.dart';
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
Expand Down Expand Up @@ -146,7 +146,7 @@ async fn main() {
Finally, receive the signals in Dart with `StreamBuilder` and rebuild the widget accordingly.

```dart title="lib/main.dart"
import 'package:test_app/messages/exports.dart';
import 'package:test_app/messages/all.dart';
children: [
StreamBuilder(
Expand Down Expand Up @@ -184,7 +184,7 @@ rinf message
```

```dart title="lib/main.dart"
import 'package:test_app/messages/exports.dart';
import 'package:test_app/messages/all.dart';
children: [
StreamBuilder(
Expand Down
4 changes: 2 additions & 2 deletions flutter_package/bin/src/helpers.dart
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ please refer to Rinf's [documentation](https://rinf.cunarist.com).
if (await mainFile.exists()) {
await Process.run('dart', ['format', './lib/main.dart']);
var mainText = await mainFile.readAsString();
if (!mainText.contains('messages/exports.dart')) {
if (!mainText.contains('messages/all.dart')) {
final lines = mainText.split('\n');
final lastImportIndex = lines.lastIndexWhere(
(line) => line.startsWith('import '),
Expand All @@ -157,7 +157,7 @@ please refer to Rinf's [documentation](https://rinf.cunarist.com).
);
lines.insert(
lastImportIndex + 2,
"import './messages/exports.dart';",
"import './messages/all.dart';",
);
mainText = lines.join('\n');
}
Expand Down

0 comments on commit 2229967

Please sign in to comment.