Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prefer double quotes in Dart #428

Closed
wants to merge 2 commits into from
Closed
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
12 changes: 6 additions & 6 deletions documentation/docs/frequently-asked-questions.md
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ After running the `protoc` command, you'll find the generated Dart files in the

```dart title="Dart"
// In your Dart code, you can import and use the well-known type:
import 'package:my_app/messages/google/protobuf/timestamp.pb.dart';
import "package:my_app/messages/google/protobuf/timestamp.pb.dart";
```

### Can I use this in pure Dart projects?
Expand Down Expand Up @@ -202,8 +202,8 @@ message MyUniqueOutput {
```

```dart title="lib/main.dart"
import 'dart:async';
import 'package:example_app/messages/tutorial_resource.pb.dart';
import "dart:async";
import "package:example_app/messages/tutorial_resource.pb.dart";

var currentInteractionId = 0;
final myUniqueOutputs = Map<int, Completer<MyUniqueOutput>>();
Expand All @@ -217,8 +217,8 @@ void main() async {
```

```dart title="lib/main.dart"
import 'dart:async';
import 'package:example_app/messages/tutorial_resource.pb.dart';
import "dart:async";
import "package:example_app/messages/tutorial_resource.pb.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/generated.dart';
import "./messages/generated.dart";

async void main() {
await initializeRust(compiledLibPath: "/path/to/library/libhub.so");
Expand Down
6 changes: 3 additions & 3 deletions documentation/docs/graceful-shutdown.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ In some cases, you might need to drop all Rust resources properly before closing
To achieve this, you can utilize Flutter's `AppLifecycleListener` to call the `finalizeRust` function before closing the Flutter app.

```dart title="lib/main.dart"
import 'dart:ui';
import 'package:flutter/material.dart';
import 'package:rinf/rinf.dart';
import "dart:ui";
import "package:flutter/material.dart";
import "package:rinf/rinf.dart";

class MyApp extends StatefulWidget {
const MyApp({super.key});
Expand Down
12 changes: 6 additions & 6 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/tutorial_messages.pb.dart';
import "package:test_app/messages/tutorial_messages.pb.dart";

child: Column(
mainAxisAlignment: MainAxisAlignment.center,
Expand All @@ -46,7 +46,7 @@ child: Column(
onPressed: () async {
MyPreciousData(
inputNumbers: [3, 4, 5],
inputString: 'Zero-cost abstraction',
inputString: "Zero-cost abstraction",
).sendSignalToRust(); // GENERATED
},
child: Text("Send a Signal from Dart to Rust"),
Expand Down Expand Up @@ -150,7 +150,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/tutorial_messages.pb.dart';
import "package:test_app/messages/tutorial_messages.pb.dart";
children: [
StreamBuilder(
stream: MyAmazingNumber.rustSignalStream, // GENERATED
Expand Down Expand Up @@ -187,19 +187,19 @@ rinf message
```

```dart title="lib/main.dart"
import 'package:test_app/messages/tutorial_messages.pb.dart';
import "package:test_app/messages/tutorial_messages.pb.dart";

children: [
StreamBuilder(
stream: MyTreasureOutput.rustSignalStream, // GENERATED
builder: (context, snapshot) {
final rustSignal = snapshot.data;
if (rustSignal == null) {
return Text('No value yet');
return Text("No value yet");
}
final myTreasureOutput = rustSignal.message;
final currentNumber = myTreasureOutput.currentValue;
return Text('Output value is $currentNumber');
return Text("Output value is $currentNumber");
},
),
ElevatedButton(
Expand Down
4 changes: 4 additions & 0 deletions flutter_package/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
include: package:lints/core.yaml

linter:
rules:
- prefer_double_quotes
8 changes: 4 additions & 4 deletions flutter_package/bin/rinf.dart
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import 'src/config.dart';
import 'src/helpers.dart';
import 'src/message.dart';
import 'src/internet.dart';
import "src/config.dart";
import "src/helpers.dart";
import "src/message.dart";
import "src/internet.dart";

Future<void> main(List<String> args) async {
if (args.isEmpty) {
Expand Down
14 changes: 7 additions & 7 deletions flutter_package/bin/src/config.dart
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import 'dart:io';
import 'package:yaml/yaml.dart';
import "dart:io";
import "package:yaml/yaml.dart";

class RinfConfigMessage {
final String inputDir;
Expand Down Expand Up @@ -42,11 +42,11 @@ class RinfConfigMessage {

@override
String toString() {
return '''message:
return """message:
$KEY_INPUT_DIR: $inputDir
$KEY_RUST_OUTPUT_DIR: $rustOutputDir
$KEY_DART_OUTPUT_DIR: $dartOutputDir
$KEY_RUST_SERDE: $rustSerde''';
$KEY_RUST_SERDE: $rustSerde""";
}

static const KEY_INPUT_DIR = "input_dir";
Expand Down Expand Up @@ -95,9 +95,9 @@ class RinfConfig {

@override
String toString() {
return '''
return """
rinf:
$message''';
$message""";
}

static const KEY_MESSAGE = "message";
Expand All @@ -122,7 +122,7 @@ rinf:
/// ```
Future<RinfConfig> loadVerifiedRinfConfig(String pubspecYamlFile) async {
final pubspec = loadYaml(await File(pubspecYamlFile).readAsString());
final YamlMap? rinfConfig = pubspec['rinf'];
final YamlMap? rinfConfig = pubspec["rinf"];
return rinfConfig == null
? RinfConfig.defaultConfig()
: RinfConfig.fromYaml(rinfConfig);
Expand Down
Loading
Loading