Skip to content

Commit

Permalink
Fix Build Errors
Browse files Browse the repository at this point in the history
  • Loading branch information
jakobkoerber committed Sep 9, 2024
1 parent 28dc420 commit ffb82e1
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 4 deletions.
13 changes: 13 additions & 0 deletions lib/base/extensions/latlng_to_json.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import 'dart:convert';

import 'package:google_maps_flutter/google_maps_flutter.dart';

extension JsonString on LatLng {
static String? toJsonString(LatLng? latLng) {
if (latLng == null) {
return null;
} else {
return const JsonEncoder().convert(latLng.toJson());
}
}
}
2 changes: 2 additions & 0 deletions lib/homeComponent/model/station.dart
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import 'package:google_maps_flutter/google_maps_flutter.dart';
import 'package:campus_flutter/base/extensions/latlng_to_json.dart';
import 'package:json_annotation/json_annotation.dart';

part 'station.g.dart';
Expand All @@ -9,6 +10,7 @@ part 'station.g.dart';
class Station {
final String name;
final String apiName;
@JsonKey(fromJson: LatLng.fromJson, toJson: JsonString.toJsonString)
final LatLng? location;

Station({required this.name, required this.apiName, this.location});
Expand Down
6 changes: 2 additions & 4 deletions lib/homeComponent/model/station.g.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit ffb82e1

Please sign in to comment.