-
Notifications
You must be signed in to change notification settings - Fork 562
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Revert "Removed local_storage conditional import"
This reverts commit c952120.
- Loading branch information
1 parent
53b4ce1
commit 94f97e8
Showing
5 changed files
with
44 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import '../local_storage.dart'; | ||
import '../utils.dart'; | ||
|
||
class LocalStorageImpl extends LocalStorage { | ||
String? _code; | ||
|
||
@override | ||
void saveUserCode(String code) => _code = code; | ||
|
||
@override | ||
String? getUserCode() => _code?.nullIfEmpty; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
// Copyright (c) 2024, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:web/web.dart' as web; | ||
|
||
import '../local_storage.dart'; | ||
import '../utils.dart'; | ||
|
||
const _userInputKey = 'user_'; | ||
|
||
class LocalStorageImpl extends LocalStorage { | ||
@override | ||
void saveUserCode(String code) => | ||
web.window.localStorage.setItem(_userInputKey, code); | ||
|
||
@override | ||
String? getUserCode() => | ||
web.window.localStorage.getItem(_userInputKey)?.nullIfEmpty; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters