-
-
Save esarbanis/7052b3d69c6113afe7925d3e285a15c0 to your computer and use it in GitHub Desktop.
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 is in `./lib` folder | |
import 'package:http/http.dart' show Client; | |
import '.env.dart'; | |
class Repository { | |
final String _baseUrl = environment.baseUrl; | |
Client _client; | |
DebtorRepository() { | |
this._client = Client(); | |
} | |
// For simplicity's sake we will not deal with json encoding/decoding | |
Future<any> info(String token) async { | |
return await this._client.get('$_baseUrl/info'); | |
} | |
} |
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
#!/bin/bash | |
dart tool/env.dart |
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 is in `./tool` folder | |
import 'dart:convert'; | |
import 'dart:io'; | |
Future<void> main() async { | |
final config = { | |
'baseUrl': Platform.environment['APP_BASE_URL'], | |
'credentials': Platform.environment['APP_CREDENTIALS'], | |
}; | |
final filename = 'lib/.env.dart'; | |
File(filename).writeAsString('final environment = ${json.encode(config)};'); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hi @esarbanis do you have any sample project for this?