This file contains hidden or 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
@override | |
Widget build(BuildContext context) { | |
return FutureBuilder<Store<AppState>>( | |
future: initStore(), | |
builder: (context, AsyncSnapshot<Store<AppState>> snapshot) { | |
if (!snapshot.hasData) { | |
return CircularProgressIndicator(); | |
} | |
return new StoreProvider( |
This file contains hidden or 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
Future<Store<AppState>> initStore() async { | |
Directory dic = await getApplicationSupportDirectory(); | |
final statePath = path.join(dic.path, 'state.json'); | |
final persistor = Persistor<AppState>( | |
storage: FileStorage(File(statePath)), | |
serializer: JsonSerializer<AppState>(AppState.fromJson), | |
); | |
final initialState = await persistor.load(); |
This file contains hidden or 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
static AppState fromJson(dynamic json) { | |
var tasks = <String, Task>{}; | |
if (json is Map && json['tasks'] is Map) { | |
json['tasks'].forEach((uuid, jsonTask) { | |
var task = Task.fromJson(jsonTask); | |
tasks[task.uuid] = task; | |
}); | |
} | |
return AppState(status: Status.noParam(StatusKey.ListTask), tasks: tasks); | |
} |
This file contains hidden or 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
Directory dic = await getApplicationSupportDirectory(); | |
final statePath = path.join(dic.path, 'state.json'); |
This file contains hidden or 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
var options = []flutter.Option{ | |
flutter.WindowInitialDimensions(800, 1280), | |
flutter.AddPlugin(&path_provider.PathProviderPlugin{ | |
VendorName: config.VendorName, | |
ApplicationName: config.AppName, | |
}), | |
} |
This file contains hidden or 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
return StoreConnector<AppState, ReduxActions>( | |
converter: (store) { | |
return new ReduxActions( | |
start: () { | |
store | |
.dispatch(new ChangeStatusAction(status: StatusKey.AddingTask)); | |
}, | |
create: (String title) { | |
store.dispatch(new ChangeStatusAction(status: StatusKey.ListTask)); | |
createTask(store, title); |
This file contains hidden or 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
package main | |
import "C" | |
//export Backend_Start | |
func Backend_Start() { | |
... | |
} | |
//export Backend_Stop |
This file contains hidden or 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
#import "libBackend.h" |
This file contains hidden or 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
import 'package:flutter/services.dart'; | |
import 'package:package_info/package_info.dart'; | |
const COMMANDS = '/COMMANDS'; | |
const CMD_OPEN_DIALOG = 'CMD:OPEN_DIALOG'; | |
MethodChannel _methodCommand; | |
Future<MethodChannel> _getCommandsChannel() async { |
OlderNewer