Skip to content

Commit 3c6798c

Browse files
committed
Replace pubspec_yaml with yaml package
1 parent 88e0ba0 commit 3c6798c

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

lib/src/services/pubspec_service.dart

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import 'dart:io';
22

3-
import 'package:pubspec_yaml/pubspec_yaml.dart';
3+
import 'package:yaml/yaml.dart';
44

55
/// Provides functionality to interact with the pubspec in the current project
66
class PubspecService {
7-
late PubspecYaml pubspecYaml;
7+
late YamlMap pubspecYaml;
88

9-
/// Reads the pubpec and caches the value locally
9+
/// Reads the pubspec and caches the value locally
1010
Future<void> initialise({String? workingDirectory}) async {
1111
final bool hasWorkingDirectory = workingDirectory != null;
1212
// stdout.writeln('PubspecService - initialise from pubspec.yaml');
13-
final pubspecYamlContent = await File(
14-
'${hasWorkingDirectory ? '$workingDirectory/' : ''}pubspec.yaml')
15-
.readAsString();
16-
pubspecYaml = pubspecYamlContent.toPubspecYaml();
13+
final pubspecYamlContent =
14+
await File('${hasWorkingDirectory ? '$workingDirectory/' : ''}pubspec.yaml').readAsString();
15+
16+
pubspecYaml = loadYaml(pubspecYamlContent) as YamlMap;
1717
// stdout.writeln('PubspecService - initialise complete');
1818
}
1919

20-
String get getPackageName => pubspecYaml.name;
20+
String get getPackageName => pubspecYaml['name'];
2121
}

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ dependencies:
1414
mockito: ^5.4.3
1515
mustache_template: ^2.0.0
1616
path: ^1.8.1
17-
pubspec_yaml: ^3.1.0
17+
yaml: ^3.1.3
1818
recase: ^4.0.0
1919
json_annotation: ^4.8.1
2020
ansicolor: ^2.0.2

0 commit comments

Comments
 (0)